mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Various refactorings.
Type hints, trailing backslash, range usage, etc.
This commit is contained in:
parent
866388b625
commit
38f468adce
6 changed files with 17 additions and 15 deletions
|
@ -50,7 +50,7 @@ def fetch_audio_devices(input_devices, output_devices):
|
|||
"""
|
||||
devices = sd.query_devices(device=None, kind=None)
|
||||
for index, device in enumerate(devices):
|
||||
# Use a try/except block beacuse Windows doesn't have an audio device range
|
||||
# Use a try/except block because Windows doesn't have an audio device range
|
||||
try:
|
||||
name = device["name"]
|
||||
|
||||
|
|
|
@ -60,7 +60,6 @@ def freedv_get_mode_name_by_value(mode: int) -> str:
|
|||
"""
|
||||
return FREEDV_MODE(mode).name
|
||||
|
||||
|
||||
# Check if we are running in a pyinstaller environment
|
||||
if hasattr(sys, "_MEIPASS"):
|
||||
sys.path.append(getattr(sys, "_MEIPASS"))
|
||||
|
@ -337,7 +336,6 @@ class resampler:
|
|||
"""
|
||||
Re-sampler class
|
||||
"""
|
||||
|
||||
# Re-sample an array of variable length, we just store the filter memories here
|
||||
MEM8 = api.FDMDV_OS_TAPS_48_8K
|
||||
MEM48 = api.FDMDV_OS_TAPS_48K
|
||||
|
|
|
@ -49,6 +49,7 @@ def signal_handler(sig, frame):
|
|||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
class DAEMON:
|
||||
"""
|
||||
|
|
|
@ -1392,6 +1392,7 @@ class DATA:
|
|||
|
||||
self.IS_ARQ_SESSION_MASTER = False
|
||||
static.ARQ_SESSION = False
|
||||
if not TESTMODE:
|
||||
self.arq_cleanup()
|
||||
|
||||
self.send_disconnect_frame()
|
||||
|
@ -2080,6 +2081,11 @@ class DATA:
|
|||
def transmit_cq(self) -> None:
|
||||
"""
|
||||
Transmit a CQ
|
||||
Args:
|
||||
Nothing
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
"""
|
||||
self.log.info("[TNC] CQ CQ CQ")
|
||||
self.send_data_to_socket_queue(
|
||||
|
|
|
@ -7,6 +7,8 @@ Created on Fri Dec 25 21:25:14 2020
|
|||
import time
|
||||
|
||||
import crcengine
|
||||
import structlog
|
||||
|
||||
import static
|
||||
import structlog
|
||||
|
||||
|
@ -27,7 +29,6 @@ def wait(seconds: float) -> bool:
|
|||
time.sleep(0.01)
|
||||
return True
|
||||
|
||||
|
||||
def get_crc_8(data) -> bytes:
|
||||
"""Author: DJ2LS
|
||||
|
||||
|
@ -46,7 +47,6 @@ def get_crc_8(data) -> bytes:
|
|||
crc_data = crc_data.to_bytes(1, byteorder="big")
|
||||
return crc_data
|
||||
|
||||
|
||||
def get_crc_16(data) -> bytes:
|
||||
"""Author: DJ2LS
|
||||
|
||||
|
@ -65,7 +65,6 @@ def get_crc_16(data) -> bytes:
|
|||
crc_data = crc_data.to_bytes(2, byteorder="big")
|
||||
return crc_data
|
||||
|
||||
|
||||
def get_crc_24(data) -> bytes:
|
||||
"""Author: DJ2LS
|
||||
|
||||
|
@ -93,7 +92,6 @@ def get_crc_24(data) -> bytes:
|
|||
crc_data = crc_data.to_bytes(3, byteorder="big")
|
||||
return crc_data
|
||||
|
||||
|
||||
def get_crc_32(data: bytes) -> bytes:
|
||||
"""Author: DJ2LS
|
||||
|
||||
|
@ -166,7 +164,6 @@ def add_to_heard_stations(dxcallsign, dxgrid, datatype, snr, offset, frequency):
|
|||
# item = [dxcallsign, int(time.time())]
|
||||
# static.HEARD_STATIONS[idx] = item
|
||||
|
||||
|
||||
def callsign_to_bytes(callsign) -> bytes:
|
||||
"""
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ class ThreadedTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
|
|||
|
||||
class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
|
||||
""" """
|
||||
connection_alive = False
|
||||
|
||||
connection_alive = False
|
||||
log = structlog.get_logger("ThreadedTCPRequestHandler")
|
||||
|
@ -182,7 +183,6 @@ class ThreadedTCPRequestHandler(socketserver.StreamRequestHandler):
|
|||
client=self.request,
|
||||
)
|
||||
|
||||
|
||||
def process_tnc_commands(data):
|
||||
"""
|
||||
process tnc commands
|
||||
|
|
Loading…
Reference in a new issue