Merge branch 'develop' into services

This commit is contained in:
Jakob Ketterl 2019-07-28 11:45:55 +02:00
commit ce662796e3

View File

@ -51,8 +51,15 @@ class Bandplan(object):
f.close() f.close()
self.bands = [Band(d) for d in bands_json] self.bands = [Band(d) for d in bands_json]
def findBands(self, freq):
return [band for band in self.bands if band.inBand(freq)]
def findBand(self, freq): def findBand(self, freq):
return next(band for band in self.bands if band.inBand(freq)) bands = self.findBands(freq)
if bands:
return bands[0]
else:
return None
def collectDialFrequencies(self, range): def collectDialFrequencies(self, range):
return [e for b in self.bands for e in b.getDialFrequencies(range)] return [e for b in self.bands for e in b.getDialFrequencies(range)]