mirror of https://github.com/DJ2LS/FreeDATA.git
Substituted unused variables with wildcard (ruff F841)
See https://peps.python.org/pep-0634/#wildcard-patternpull/1048/head
parent
b187628c3e
commit
1f4efac11e
|
|
@ -115,7 +115,7 @@ class ARQSessionIRS(arq_session.ARQSession):
|
|||
# register arq session in p2p connection
|
||||
self.running_p2p_connection.running_arq_session = self
|
||||
self.running_p2p_connection.set_state(P2PStates.ARQ_SESSION)
|
||||
except Exception as e:
|
||||
except Exception as _:
|
||||
self.log("Error getting p2p connection session")
|
||||
|
||||
self.type_byte = None
|
||||
|
|
@ -414,10 +414,7 @@ class ARQSessionIRS(arq_session.ARQSession):
|
|||
Returns:
|
||||
int: The calculated speed level.
|
||||
"""
|
||||
if burst_frame:
|
||||
received_speed_level = burst_frame["speed_level"]
|
||||
else:
|
||||
received_speed_level = 0
|
||||
_received_speed_level = burst_frame["speed_level"] if burst_frame else 0
|
||||
|
||||
latest_snr = self.snr if self.snr else -10
|
||||
appropriate_speed_level = self.get_appropriate_speed_level(
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ def get_device_index_from_crc(crc, isInput: bool):
|
|||
if dev["id"] == crc:
|
||||
return (dev["native_index"], dev["name"])
|
||||
|
||||
except Exception as e:
|
||||
except Exception as _:
|
||||
log.warning(f"Audio device {crc} not detected ", devices=detected_devices, isInput=isInput)
|
||||
return [None, None]
|
||||
|
||||
|
|
@ -285,8 +285,8 @@ def normalize_audio(datalist: np.ndarray) -> np.ndarray:
|
|||
normalized_data = np.clip(normalized_data, -32768, 32767).astype(np.int16)
|
||||
|
||||
# Debug information: normalization factor, loudest value before, and after normalization
|
||||
loudest_before = max_value
|
||||
loudest_after = np.max(np.abs(normalized_data))
|
||||
_loudest_before = max_value
|
||||
_loudest_after = np.max(np.abs(normalized_data))
|
||||
# print(f"[AUDIO] Normalization factor: {normalization_factor:.6f}, Loudest before: {loudest_before}, Loudest after: {loudest_after}")
|
||||
|
||||
return normalized_data
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ for file in files:
|
|||
api = ctypes.CDLL(file)
|
||||
log.info("[C2 ] Libcodec2 loaded", path=file)
|
||||
break
|
||||
except OSError as err:
|
||||
except OSError as _:
|
||||
pass
|
||||
# log.info("[C2 ] Error: Libcodec2 found but not loaded", path=file, e=err)
|
||||
|
||||
|
|
|
|||
|
|
@ -166,10 +166,7 @@ class radio:
|
|||
self.parameters["ptt"] = state
|
||||
if self.connected:
|
||||
try:
|
||||
if state:
|
||||
result = self.server.rig.set_ptt(1)
|
||||
else:
|
||||
result = self.server.rig.set_ptt(0)
|
||||
_result = self.server.rig.set_ptt(1) if state else self.server.rig.set_ptt(0)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Set PTT failed: {e}")
|
||||
return state
|
||||
|
|
|
|||
|
|
@ -608,7 +608,7 @@ def get_hmac_salt(dxcallsign: bytes, mycallsign: bytes):
|
|||
try:
|
||||
subfolder = Path("hmac")
|
||||
filepath = subfolder / filename
|
||||
except Exception as e:
|
||||
except Exception as _:
|
||||
log.error(
|
||||
"[Modem] [HMAC] File lookup error",
|
||||
file=filepath,
|
||||
|
|
@ -657,7 +657,7 @@ def search_hmac_salt(dxcallsign: bytes, mycallsign: bytes, search_token, data_fr
|
|||
try:
|
||||
subfolder = Path("hmac")
|
||||
filepath = subfolder / filename
|
||||
except Exception as e:
|
||||
except Exception as _:
|
||||
log.error(
|
||||
"[Modem] [HMAC] File lookup error",
|
||||
file=filepath,
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class DatabaseManagerMessages(DatabaseManager):
|
|||
self.log(f"Added data to database: {new_message.id}")
|
||||
self.ctx.event_manager.freedata_message_db_change(message_id=new_message.id)
|
||||
return new_message.id
|
||||
except IntegrityError as e:
|
||||
except IntegrityError as _:
|
||||
session.rollback() # Roll back the session to a clean state
|
||||
self.log(
|
||||
f"Message with ID {message_data['id']} already exists in the database.",
|
||||
|
|
@ -252,7 +252,7 @@ class DatabaseManagerMessages(DatabaseManager):
|
|||
destination = message_dict.get("destination", "")
|
||||
timestamp = message_dict.get("timestamp", "")
|
||||
direction = message_dict.get("direction", "").lower() # Ensure case insensitivity
|
||||
status = message_dict.get("status", "")
|
||||
_status = message_dict.get("status", "")
|
||||
statistics = message_dict.get("statistics", {})
|
||||
|
||||
# Determine the CALL based on the direction
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ class P2PConnection:
|
|||
if self.state in self.STATE_TRANSITION:
|
||||
if frame_type in self.STATE_TRANSITION[self.state]:
|
||||
action_name = self.STATE_TRANSITION[self.state][frame_type]
|
||||
response = getattr(self, action_name)(frame)
|
||||
_response = getattr(self, action_name)(frame)
|
||||
return
|
||||
|
||||
self.log(
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class SocketCommandHandler:
|
|||
self.log(f">>>>> {message}")
|
||||
full_message = f"{message}\r"
|
||||
self.cmd_request.sendall(full_message.encode())
|
||||
except Exception as e:
|
||||
except Exception as _:
|
||||
self.log(f"Error sending to socket: {message}", isWarning=True)
|
||||
|
||||
def handle_connect(self, data):
|
||||
|
|
@ -43,7 +43,7 @@ class SocketCommandHandler:
|
|||
# self.session.connect()
|
||||
# else:
|
||||
# self.send_response("ERROR")
|
||||
except Exception as e:
|
||||
except Exception as _:
|
||||
self.send_response(f"ERR: {data}")
|
||||
|
||||
def handle_disconnect(self, data):
|
||||
|
|
|
|||
|
|
@ -82,5 +82,5 @@ class stats:
|
|||
# print(response.status_code)
|
||||
# print(response.content)
|
||||
|
||||
except Exception as e:
|
||||
except Exception as _:
|
||||
log.warning("[API] connection lost")
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ def demod(txbuffer):
|
|||
# 3 trial sync
|
||||
# 6 decoded
|
||||
# 10 error decoding == NACK
|
||||
rx_status = api.freedv_get_rx_status(freedv)
|
||||
# rx_status = api.freedv_get_rx_status(freedv)
|
||||
# print(rx_status)
|
||||
|
||||
# decrement codec traffic counter for making state smoother
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class FreeDV:
|
|||
|
||||
while audiobuffer.nbuffer >= nin:
|
||||
nbytes = api.freedv_rawdatarx(self.freedv, bytes_out, audiobuffer.buffer.ctypes)
|
||||
rx_status = api.freedv_get_rx_status(self.freedv)
|
||||
_rx_status = api.freedv_get_rx_status(self.freedv)
|
||||
nin = api.freedv_nin(self.freedv)
|
||||
audiobuffer.pop(nin)
|
||||
if nbytes == bytes_per_frame:
|
||||
|
|
|
|||
Loading…
Reference in New Issue