run black
This commit is contained in:
parent
91669a7fda
commit
9246500c95
@ -26,6 +26,7 @@ class Bookmark(object):
|
||||
|
||||
class Bookmarks(object):
|
||||
sharedInstance = None
|
||||
|
||||
@staticmethod
|
||||
def getSharedInstance():
|
||||
if Bookmarks.sharedInstance is None:
|
||||
|
@ -242,7 +242,7 @@ class OpenWebRxReceiverClient(Client):
|
||||
self.send(bytes([0x03]) + data)
|
||||
|
||||
def write_secondary_demod(self, data):
|
||||
message = data.decode('ascii')
|
||||
message = data.decode("ascii")
|
||||
self.send({"type": "secondary_demod", "value": message})
|
||||
|
||||
def write_secondary_dsp_config(self, cfg):
|
||||
|
@ -87,7 +87,7 @@ class FeatureDetector(object):
|
||||
return inspect.getdoc(self._get_requirement_method(requirement))
|
||||
|
||||
def command_is_runnable(self, command):
|
||||
tmp_dir = PropertyManager.getSharedInstance()['temporary_directory']
|
||||
tmp_dir = PropertyManager.getSharedInstance()["temporary_directory"]
|
||||
cmd = shlex.split(command)
|
||||
try:
|
||||
process = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, cwd=tmp_dir)
|
||||
|
@ -69,13 +69,7 @@ class PskReporter(object):
|
||||
def spotEquals(self, s1, s2):
|
||||
keys = ["callsign", "timestamp", "locator", "mode", "msg"]
|
||||
|
||||
return reduce(
|
||||
and_,
|
||||
map(
|
||||
lambda key: s1[key] == s2[key],
|
||||
keys
|
||||
)
|
||||
)
|
||||
return reduce(and_, map(lambda key: s1[key] == s2[key], keys))
|
||||
|
||||
def spot(self, spot):
|
||||
if not spot["mode"] in PskReporter.supportedModes:
|
||||
|
@ -206,12 +206,12 @@ class ServiceHandler(object):
|
||||
def isSupported(self, mode):
|
||||
# TODO this should be in a more central place (the frontend also needs this)
|
||||
requirements = {
|
||||
'ft8': 'wsjt-x',
|
||||
'ft4': 'wsjt-x',
|
||||
'jt65': 'wsjt-x',
|
||||
'jt9': 'wsjt-x',
|
||||
'wspr': 'wsjt-x',
|
||||
'packet': 'packet',
|
||||
"ft8": "wsjt-x",
|
||||
"ft4": "wsjt-x",
|
||||
"jt65": "wsjt-x",
|
||||
"jt9": "wsjt-x",
|
||||
"wspr": "wsjt-x",
|
||||
"packet": "packet",
|
||||
}
|
||||
fd = FeatureDetector()
|
||||
|
||||
@ -298,7 +298,6 @@ class ServiceHandler(object):
|
||||
# resampler goes in after the services since it must not be shutdown as long as the services are still running
|
||||
self.services.append(resampler)
|
||||
|
||||
|
||||
def optimizeResampling(self, freqs, bandwidth):
|
||||
freqs = sorted(freqs, key=lambda f: f["frequency"])
|
||||
distances = [
|
||||
@ -380,6 +379,7 @@ class AprsHandler(object):
|
||||
|
||||
class Services(object):
|
||||
handlers = []
|
||||
|
||||
@staticmethod
|
||||
def start():
|
||||
if not PropertyManager.getSharedInstance()["services_enabled"]:
|
||||
|
@ -119,9 +119,7 @@ class SdrSource(object):
|
||||
self.props = props
|
||||
self.profile_id = None
|
||||
self.activateProfile()
|
||||
self.rtlProps = self.props.collect(
|
||||
*self.getEventNames()
|
||||
).defaults(PropertyManager.getSharedInstance())
|
||||
self.rtlProps = self.props.collect(*self.getEventNames()).defaults(PropertyManager.getSharedInstance())
|
||||
self.wireEvents()
|
||||
|
||||
self.port = port
|
||||
@ -136,7 +134,18 @@ class SdrSource(object):
|
||||
self.busyState = SdrSource.BUSYSTATE_IDLE
|
||||
|
||||
def getEventNames(self):
|
||||
return ["samp_rate", "nmux_memory", "center_freq", "ppm", "rf_gain", "lna_gain", "rf_amp", "antenna", "if_gain", "lfo_offset"]
|
||||
return [
|
||||
"samp_rate",
|
||||
"nmux_memory",
|
||||
"center_freq",
|
||||
"ppm",
|
||||
"rf_gain",
|
||||
"lna_gain",
|
||||
"rf_amp",
|
||||
"antenna",
|
||||
"if_gain",
|
||||
"lfo_offset",
|
||||
]
|
||||
|
||||
def wireEvents(self):
|
||||
def restart(name, value):
|
||||
@ -206,9 +215,7 @@ class SdrSource(object):
|
||||
|
||||
props = self.rtlProps
|
||||
|
||||
cmd = self.getCommand().format(
|
||||
**self.getCommandValues()
|
||||
)
|
||||
cmd = self.getCommand().format(**self.getCommandValues())
|
||||
|
||||
format_conversion = self.getFormatConversion()
|
||||
if format_conversion is not None:
|
||||
@ -459,11 +466,16 @@ class ConnectorSource(SdrSource):
|
||||
def reconfigure(prop, value):
|
||||
if self.monitor is None:
|
||||
return
|
||||
if (prop == "center_freq" or prop == "lfo_offset") and "lfo_offset" in self.rtlProps and self.rtlProps["lfo_offset"] is not None:
|
||||
if (
|
||||
(prop == "center_freq" or prop == "lfo_offset")
|
||||
and "lfo_offset" in self.rtlProps
|
||||
and self.rtlProps["lfo_offset"] is not None
|
||||
):
|
||||
freq = self.rtlProps["center_freq"] + self.rtlProps["lfo_offset"]
|
||||
self.sendControlMessage("center_freq", freq)
|
||||
else:
|
||||
self.sendControlMessage(prop, value)
|
||||
|
||||
self.rtlProps.wire(reconfigure)
|
||||
|
||||
def postStart(self):
|
||||
@ -486,11 +498,21 @@ class ConnectorSource(SdrSource):
|
||||
|
||||
class RtlSdrConnectorSource(ConnectorSource):
|
||||
def getEventNames(self):
|
||||
return ["samp_rate", "center_freq", "ppm", "rf_gain", "device", "iqswap", "lfo_offset"]
|
||||
return [
|
||||
"samp_rate",
|
||||
"center_freq",
|
||||
"ppm",
|
||||
"rf_gain",
|
||||
"device",
|
||||
"iqswap",
|
||||
"lfo_offset",
|
||||
]
|
||||
|
||||
def getCommand(self):
|
||||
cmd = "rtl_connector -p {port} -c {controlPort}".format(port=self.port, controlPort=self.controlPort) +\
|
||||
" -s {samp_rate} -f {tuner_freq} -g {rf_gain} -P {ppm} -d {device}"
|
||||
cmd = (
|
||||
"rtl_connector -p {port} -c {controlPort}".format(port=self.port, controlPort=self.controlPort)
|
||||
+ " -s {samp_rate} -f {tuner_freq} -g {rf_gain} -P {ppm} -d {device}"
|
||||
)
|
||||
if self.rtlProps["iqswap"]:
|
||||
cmd += " -i"
|
||||
return cmd
|
||||
@ -498,11 +520,22 @@ class RtlSdrConnectorSource(ConnectorSource):
|
||||
|
||||
class SdrplayConnectorSource(ConnectorSource):
|
||||
def getEventNames(self):
|
||||
return ["samp_rate", "center_freq", "ppm", "rf_gain", "antenna", "device", "iqswap", "lfo_offset"]
|
||||
return [
|
||||
"samp_rate",
|
||||
"center_freq",
|
||||
"ppm",
|
||||
"rf_gain",
|
||||
"antenna",
|
||||
"device",
|
||||
"iqswap",
|
||||
"lfo_offset",
|
||||
]
|
||||
|
||||
def getCommand(self):
|
||||
cmd = "soapy_connector -p {port} -c {controlPort}".format(port=self.port, controlPort=self.controlPort) +\
|
||||
" -s {samp_rate} -f {tuner_freq} -g \"{rf_gain}\" -P {ppm} -a \"{antenna}\" -d \"{device}\""
|
||||
cmd = (
|
||||
"soapy_connector -p {port} -c {controlPort}".format(port=self.port, controlPort=self.controlPort)
|
||||
+ ' -s {samp_rate} -f {tuner_freq} -g "{rf_gain}" -P {ppm} -a "{antenna}" -d "{device}"'
|
||||
)
|
||||
if self.rtlProps["iqswap"]:
|
||||
cmd += " -i"
|
||||
return cmd
|
||||
@ -510,11 +543,22 @@ class SdrplayConnectorSource(ConnectorSource):
|
||||
|
||||
class AirspyConnectorSource(ConnectorSource):
|
||||
def getEventNames(self):
|
||||
return ["samp_rate", "center_freq", "ppm", "rf_gain", "device", "iqswap", "lfo_offset", "bias_tee"]
|
||||
return [
|
||||
"samp_rate",
|
||||
"center_freq",
|
||||
"ppm",
|
||||
"rf_gain",
|
||||
"device",
|
||||
"iqswap",
|
||||
"lfo_offset",
|
||||
"bias_tee",
|
||||
]
|
||||
|
||||
def getCommand(self):
|
||||
cmd = "soapy_connector -p {port} -c {controlPort}".format(port=self.port, controlPort=self.controlPort) + \
|
||||
" -s {samp_rate} -f {tuner_freq} -g \"{rf_gain}\" -P {ppm} -d \"{device}\""
|
||||
cmd = (
|
||||
"soapy_connector -p {port} -c {controlPort}".format(port=self.port, controlPort=self.controlPort)
|
||||
+ ' -s {samp_rate} -f {tuner_freq} -g "{rf_gain}" -P {ppm} -d "{device}"'
|
||||
)
|
||||
if self.rtlProps["iqswap"]:
|
||||
cmd += " -i"
|
||||
if self.rtlProps["bias_tee"]:
|
||||
|
@ -120,7 +120,6 @@ class WebSocketConnection(object):
|
||||
self._sendBytes(data_to_send)
|
||||
|
||||
def _sendBytes(self, data_to_send):
|
||||
|
||||
def chunks(l, n):
|
||||
"""Yield successive n-sized chunks from l."""
|
||||
for i in range(0, len(l), n):
|
||||
|
Loading…
Reference in New Issue
Block a user