mirror of
https://github.com/smittix/intercept.git
synced 2026-07-08 01:28:13 -07:00
style: apply ruff-format to entire codebase
First-time run of ruff-format via pre-commit hook normalises quote style, trailing commas, and whitespace across 188 Python files. No logic changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+50
-55
@@ -17,21 +17,21 @@ class LimeSDRCommandBuilder(CommandBuilder):
|
||||
|
||||
CAPABILITIES = SDRCapabilities(
|
||||
sdr_type=SDRType.LIME_SDR,
|
||||
freq_min_mhz=0.1, # 100 kHz
|
||||
freq_max_mhz=3800.0, # 3.8 GHz
|
||||
freq_min_mhz=0.1, # 100 kHz
|
||||
freq_max_mhz=3800.0, # 3.8 GHz
|
||||
gain_min=0.0,
|
||||
gain_max=73.0, # Combined LNA + TIA + PGA
|
||||
gain_max=73.0, # Combined LNA + TIA + PGA
|
||||
sample_rates=[1000000, 2000000, 4000000, 8000000, 10000000, 20000000],
|
||||
supports_bias_t=False,
|
||||
supports_ppm=False, # Uses TCXO, no PPM correction needed
|
||||
tx_capable=True
|
||||
supports_ppm=False, # Uses TCXO, no PPM correction needed
|
||||
tx_capable=True,
|
||||
)
|
||||
|
||||
def _build_device_string(self, device: SDRDevice) -> str:
|
||||
"""Build SoapySDR device string for LimeSDR."""
|
||||
if device.serial and device.serial != 'N/A':
|
||||
return f'driver=lime,serial={device.serial}'
|
||||
return 'driver=lime'
|
||||
if device.serial and device.serial != "N/A":
|
||||
return f"driver=lime,serial={device.serial}"
|
||||
return "driver=lime"
|
||||
|
||||
def build_fm_demod_command(
|
||||
self,
|
||||
@@ -42,7 +42,7 @@ class LimeSDRCommandBuilder(CommandBuilder):
|
||||
ppm: int | None = None,
|
||||
modulation: str = "fm",
|
||||
squelch: int | None = None,
|
||||
bias_t: bool = False
|
||||
bias_t: bool = False,
|
||||
) -> list[str]:
|
||||
"""
|
||||
Build SoapySDR rx_fm command for FM demodulation.
|
||||
@@ -52,33 +52,32 @@ class LimeSDRCommandBuilder(CommandBuilder):
|
||||
"""
|
||||
device_str = self._build_device_string(device)
|
||||
|
||||
rx_fm_path = get_tool_path('rx_fm') or 'rx_fm'
|
||||
rx_fm_path = get_tool_path("rx_fm") or "rx_fm"
|
||||
cmd = [
|
||||
rx_fm_path,
|
||||
'-d', device_str,
|
||||
'-f', f'{frequency_mhz}M',
|
||||
'-M', modulation,
|
||||
'-s', str(sample_rate),
|
||||
"-d",
|
||||
device_str,
|
||||
"-f",
|
||||
f"{frequency_mhz}M",
|
||||
"-M",
|
||||
modulation,
|
||||
"-s",
|
||||
str(sample_rate),
|
||||
]
|
||||
|
||||
if gain is not None and gain > 0:
|
||||
# LimeSDR gain is applied to LNAH element
|
||||
cmd.extend(['-g', f'LNAH={int(gain)}'])
|
||||
cmd.extend(["-g", f"LNAH={int(gain)}"])
|
||||
|
||||
if squelch is not None and squelch > 0:
|
||||
cmd.extend(['-l', str(squelch)])
|
||||
cmd.extend(["-l", str(squelch)])
|
||||
|
||||
# Output to stdout
|
||||
cmd.append('-')
|
||||
cmd.append("-")
|
||||
|
||||
return cmd
|
||||
|
||||
def build_adsb_command(
|
||||
self,
|
||||
device: SDRDevice,
|
||||
gain: float | None = None,
|
||||
bias_t: bool = False
|
||||
) -> list[str]:
|
||||
def build_adsb_command(self, device: SDRDevice, gain: float | None = None, bias_t: bool = False) -> list[str]:
|
||||
"""
|
||||
Build dump1090 command with SoapySDR support for ADS-B decoding.
|
||||
|
||||
@@ -89,16 +88,10 @@ class LimeSDRCommandBuilder(CommandBuilder):
|
||||
device_str = self._build_device_string(device)
|
||||
|
||||
# Try readsb first (better SoapySDR support), fallback to dump1090
|
||||
cmd = [
|
||||
'readsb',
|
||||
'--net',
|
||||
'--device-type', 'soapysdr',
|
||||
'--device', device_str,
|
||||
'--quiet'
|
||||
]
|
||||
cmd = ["readsb", "--net", "--device-type", "soapysdr", "--device", device_str, "--quiet"]
|
||||
|
||||
if gain is not None:
|
||||
cmd.extend(['--gain', str(int(gain))])
|
||||
cmd.extend(["--gain", str(int(gain))])
|
||||
|
||||
return cmd
|
||||
|
||||
@@ -108,7 +101,7 @@ class LimeSDRCommandBuilder(CommandBuilder):
|
||||
frequency_mhz: float = 433.92,
|
||||
gain: float | None = None,
|
||||
ppm: int | None = None,
|
||||
bias_t: bool = False
|
||||
bias_t: bool = False,
|
||||
) -> list[str]:
|
||||
"""
|
||||
Build rtl_433 command with SoapySDR support for ISM band decoding.
|
||||
@@ -118,20 +111,15 @@ class LimeSDRCommandBuilder(CommandBuilder):
|
||||
"""
|
||||
device_str = self._build_device_string(device)
|
||||
|
||||
cmd = [
|
||||
'rtl_433',
|
||||
'-d', device_str,
|
||||
'-f', f'{frequency_mhz}M',
|
||||
'-F', 'json'
|
||||
]
|
||||
cmd = ["rtl_433", "-d", device_str, "-f", f"{frequency_mhz}M", "-F", "json"]
|
||||
|
||||
if gain is not None and gain > 0:
|
||||
cmd.extend(['-g', str(int(gain))])
|
||||
cmd.extend(["-g", str(int(gain))])
|
||||
|
||||
# PPM not typically needed for LimeSDR (TCXO)
|
||||
# but include if specified
|
||||
if ppm is not None and ppm != 0:
|
||||
cmd.extend(['-p', str(ppm)])
|
||||
cmd.extend(["-p", str(ppm)])
|
||||
|
||||
return cmd
|
||||
|
||||
@@ -153,18 +141,21 @@ class LimeSDRCommandBuilder(CommandBuilder):
|
||||
device_str = self._build_device_string(device)
|
||||
|
||||
cmd = [
|
||||
'AIS-catcher',
|
||||
'-d', f'soapysdr -d {device_str}',
|
||||
'-S', str(tcp_port),
|
||||
'-o', '5',
|
||||
'-q',
|
||||
"AIS-catcher",
|
||||
"-d",
|
||||
f"soapysdr -d {device_str}",
|
||||
"-S",
|
||||
str(tcp_port),
|
||||
"-o",
|
||||
"5",
|
||||
"-q",
|
||||
]
|
||||
|
||||
if gain is not None and gain > 0:
|
||||
cmd.extend(['-gr', 'tuner', str(int(gain))])
|
||||
cmd.extend(["-gr", "tuner", str(int(gain))])
|
||||
|
||||
if udp_host and udp_port:
|
||||
cmd.extend(['-u', udp_host, str(udp_port)])
|
||||
cmd.extend(["-u", udp_host, str(udp_port)])
|
||||
|
||||
return cmd
|
||||
|
||||
@@ -176,7 +167,7 @@ class LimeSDRCommandBuilder(CommandBuilder):
|
||||
gain: float | None = None,
|
||||
ppm: int | None = None,
|
||||
bias_t: bool = False,
|
||||
output_format: str = 'cu8',
|
||||
output_format: str = "cu8",
|
||||
) -> list[str]:
|
||||
"""
|
||||
Build rx_sdr command for raw I/Q capture with LimeSDR.
|
||||
@@ -187,20 +178,24 @@ class LimeSDRCommandBuilder(CommandBuilder):
|
||||
device_str = self._build_device_string(device)
|
||||
freq_hz = int(frequency_mhz * 1e6)
|
||||
|
||||
rx_sdr_path = get_tool_path('rx_sdr') or 'rx_sdr'
|
||||
rx_sdr_path = get_tool_path("rx_sdr") or "rx_sdr"
|
||||
cmd = [
|
||||
rx_sdr_path,
|
||||
'-d', device_str,
|
||||
'-f', str(freq_hz),
|
||||
'-s', str(sample_rate),
|
||||
'-F', 'CU8',
|
||||
"-d",
|
||||
device_str,
|
||||
"-f",
|
||||
str(freq_hz),
|
||||
"-s",
|
||||
str(sample_rate),
|
||||
"-F",
|
||||
"CU8",
|
||||
]
|
||||
|
||||
if gain is not None and gain > 0:
|
||||
cmd.extend(['-g', f'LNAH={int(gain)}'])
|
||||
cmd.extend(["-g", f"LNAH={int(gain)}"])
|
||||
|
||||
# Output to stdout
|
||||
cmd.append('-')
|
||||
cmd.append("-")
|
||||
|
||||
return cmd
|
||||
|
||||
|
||||
Reference in New Issue
Block a user