mirror of
https://github.com/ha7ilm/openwebrx.git
synced 2026-03-07 21:54:05 +01:00
apply downwards-compatible typing (for python < 3.9)
This commit is contained in:
parent
23be56007b
commit
b3745ae54c
|
|
@ -1,5 +1,6 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from owrx.form.error import ValidationError
|
||||
from typing import List
|
||||
|
||||
|
||||
class Validator(ABC):
|
||||
|
|
@ -42,7 +43,7 @@ class RangeValidator(Validator):
|
|||
|
||||
|
||||
class RangeListValidator(Validator):
|
||||
def __init__(self, rangeList: list[Range]):
|
||||
def __init__(self, rangeList: List[Range]):
|
||||
self.rangeList = rangeList
|
||||
|
||||
def validate(self, key, value) -> None:
|
||||
|
|
|
|||
|
|
@ -679,6 +679,6 @@ class SdrDeviceDescription(object):
|
|||
self.getProfileOptionalKeys(),
|
||||
)
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
# semi-sane default value. should be overridden with more specific values per device.
|
||||
return [Range(500000, 10000000)]
|
||||
|
|
|
|||
|
|
@ -123,5 +123,5 @@ class AfedriDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getNumberOfChannels(self) -> int:
|
||||
return 4
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [Range(48000, 2400000)]
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class AirspyDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getGainStages(self):
|
||||
return ["LNA", "MIX", "VGA"]
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
# Airspy R2 does 2.5 or 10 MS/s
|
||||
# Airspy mini does 3 or 6 MS/s
|
||||
# we don't know what device we're actually dealing with, but we can still clamp it down to a sum of the options.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
||||
from owrx.form.input.validator import Range
|
||||
from typing import List
|
||||
|
||||
|
||||
class AirspyhfSource(SoapyConnectorSource):
|
||||
|
|
@ -15,7 +16,7 @@ class AirspyhfDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
# not currently supported by the SoapySDR module.
|
||||
return False
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [
|
||||
Range(192000),
|
||||
Range(256000),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
||||
from owrx.form.input.validator import Range
|
||||
from typing import List
|
||||
|
||||
|
||||
class BladerfSource(SoapyConnectorSource):
|
||||
|
|
@ -11,5 +12,5 @@ class BladerfDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getName(self):
|
||||
return "Blade RF"
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [Range(160000, 40000000)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
||||
from owrx.form.input.validator import Range
|
||||
from typing import List
|
||||
|
||||
|
||||
class FcdppSource(SoapyConnectorSource):
|
||||
|
|
@ -11,7 +12,7 @@ class FcdppDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getName(self):
|
||||
return "FunCube Dongle Pro+"
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [
|
||||
Range(96000),
|
||||
Range(192000),
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class FifiSdrDeviceDescription(DirectSourceDeviceDescription):
|
|||
def getDeviceOptionalKeys(self):
|
||||
return super().getDeviceOptionalKeys() + ["device"]
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [
|
||||
Range(48000),
|
||||
Range(96000),
|
||||
|
|
|
|||
|
|
@ -36,5 +36,5 @@ class HackrfDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getGainStages(self):
|
||||
return ["LNA", "AMP", "VGA"]
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [Range(1000000, 20000000)]
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class HpsdrDeviceDescription(ConnectorDeviceDescription):
|
|||
def getProfileOptionalKeys(self):
|
||||
return list(filter(lambda x : x != "iqswap", super().getProfileOptionalKeys()))
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [
|
||||
Range(48000),
|
||||
Range(96000),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
||||
from owrx.form.input.validator import Range
|
||||
from typing import List
|
||||
|
||||
|
||||
class LimeSdrSource(SoapyConnectorSource):
|
||||
|
|
@ -11,5 +12,5 @@ class LimeSdrDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getName(self):
|
||||
return "LimeSDR device"
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [Range(100000, 65000000)]
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class PerseussdrDeviceDescription(DirectSourceDeviceDescription):
|
|||
"wideband",
|
||||
]
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [
|
||||
Range(125000),
|
||||
Range(250000),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
||||
from owrx.form.input.validator import Range
|
||||
from typing import List
|
||||
|
||||
|
||||
class PlutoSdrSource(SoapyConnectorSource):
|
||||
|
|
@ -11,5 +12,5 @@ class PlutoSdrDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getName(self):
|
||||
return "PlutoSDR"
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [Range(520833, 61440000)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
||||
from owrx.form.input.validator import Range
|
||||
from typing import List
|
||||
|
||||
|
||||
class RadioberrySource(SoapyConnectorSource):
|
||||
|
|
@ -11,7 +12,7 @@ class RadioberryDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getName(self):
|
||||
return "RadioBerry"
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [
|
||||
Range(48000),
|
||||
Range(96000),
|
||||
|
|
|
|||
|
|
@ -37,5 +37,5 @@ class RtlSdrDeviceDescription(ConnectorDeviceDescription):
|
|||
def getProfileOptionalKeys(self):
|
||||
return super().getProfileOptionalKeys() + ["bias_tee", "direct_sampling"]
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [Range(250000, 3200000)]
|
||||
|
|
|
|||
|
|
@ -28,5 +28,5 @@ class RtlSdrSoapyDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getProfileOptionalKeys(self):
|
||||
return super().getProfileOptionalKeys() + ["bias_tee", "direct_sampling"]
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [Range(250000, 3200000)]
|
||||
|
|
|
|||
|
|
@ -38,5 +38,5 @@ class RtlTcpDeviceDescription(ConnectorDeviceDescription):
|
|||
def getProfileOptionalKeys(self):
|
||||
return super().getProfileOptionalKeys() + ["direct_sampling"]
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
return [Range(250000, 3200000)]
|
||||
|
|
|
|||
|
|
@ -58,6 +58,6 @@ class RundsDeviceDescription(ConnectorDeviceDescription):
|
|||
def getDeviceOptionalKeys(self):
|
||||
return super().getDeviceOptionalKeys() + ["protocol", "long"]
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
# can't be very specific here due to the wide range of devices, so this is more of a sanity check.
|
||||
return [Range(0, 20000000)]
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from owrx.source.connector import ConnectorSource, ConnectorDeviceDescription
|
||||
from owrx.form.input.validator import Range
|
||||
from typing import List
|
||||
|
||||
|
||||
class SddcSource(ConnectorSource):
|
||||
|
|
@ -14,6 +15,6 @@ class SddcDeviceDescription(ConnectorDeviceDescription):
|
|||
def hasAgc(self):
|
||||
return False
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
# resampling is done in software... it can't cover the full range, but it's not finished either.
|
||||
return [Range(0, 64000000)]
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ class SdrplayDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
"bias_tee", "rf_notch", "dab_notch", "external_reference", "hdr_ctrl"
|
||||
]
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
# this is from SoapySDRPlay3's implementation of listSampleRates().
|
||||
# i don't think it's accurate, but this is the limitation we'd be running into if we had proper soapy
|
||||
# integration.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from owrx.source.soapy import SoapyConnectorSource, SoapyConnectorDeviceDescription
|
||||
from owrx.form.input.validator import Range
|
||||
from typing import List
|
||||
|
||||
|
||||
class UhdSource(SoapyConnectorSource):
|
||||
|
|
@ -11,6 +12,6 @@ class UhdDeviceDescription(SoapyConnectorDeviceDescription):
|
|||
def getName(self):
|
||||
return "Ettus Research USRP device"
|
||||
|
||||
def getSampleRateRanges(self) -> list[Range]:
|
||||
def getSampleRateRanges(self) -> List[Range]:
|
||||
# not sure since this depends of the specific model
|
||||
return [Range(0, 64000000)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue