mirror of https://github.com/DJ2LS/FreeDATA.git
Removed f-strings without placeholders (ruff F541)
parent
fbb151838b
commit
444c0d37cf
|
|
@ -27,8 +27,8 @@ def send_adif_qso_data(ctx, adif_data):
|
|||
# Set a timeout of 3 seconds to avoid blocking indefinitely
|
||||
sock.settimeout(3)
|
||||
|
||||
callsign_start = adif_data.find(f">") + 1
|
||||
callsign_end = adif_data.find(f"<QSO_DATE", callsign_start)
|
||||
callsign_start = adif_data.find(">") + 1
|
||||
callsign_end = adif_data.find("<QSO_DATE", callsign_start)
|
||||
call_value = adif_data[callsign_start:callsign_end]
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ class ARQSessionIRS(arq_session.ARQSession):
|
|||
|
||||
if open_frame["protocol_version"] not in [self.protocol_version]:
|
||||
self.abort = True
|
||||
self.log(f"Protocol version mismatch! Setting disconnect flag!", isWarning=True)
|
||||
self.log("Protocol version mismatch! Setting disconnect flag!", isWarning=True)
|
||||
self.set_state(IRS_State.ABORTED)
|
||||
|
||||
ack_frame = self.frame_factory.build_arq_session_open_ack(
|
||||
|
|
|
|||
|
|
@ -136,12 +136,12 @@ class ARQSessionISS(arq_session.ARQSession):
|
|||
]:
|
||||
# If a matching CRC is found, use this session ID
|
||||
self.log(
|
||||
f"Matching CRC found, deleting existing session and resuming transmission",
|
||||
"Matching CRC found, deleting existing session and resuming transmission",
|
||||
isWarning=True,
|
||||
)
|
||||
self.ctx.state_manager.remove_arq_iss_session(session_id)
|
||||
return session_id
|
||||
self.log(f"No matching CRC found, creating new session id", isWarning=False)
|
||||
self.log("No matching CRC found, creating new session id", isWarning=False)
|
||||
|
||||
# Compute 8-bit integer from the 32-bit CRC
|
||||
# Convert the byte sequence to a 32-bit integer (little-endian)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class SendMessageCommand(TxCommand):
|
|||
threading.Event().wait(0.1)
|
||||
if self.ctx.state_manager.is_receiving_codec2_signal():
|
||||
self.log(
|
||||
f"Codec2 signal found, skipping message until next cycle", isWarning=True
|
||||
"Codec2 signal found, skipping message until next cycle", isWarning=True
|
||||
)
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class EventManager:
|
|||
self.ctx.TESTMODE_EVENTS.put(data)
|
||||
|
||||
for q in self.queues:
|
||||
self.logger.debug(f"Event: ", ev=data)
|
||||
self.logger.debug("Event: ", ev=data)
|
||||
if q.qsize() > 10:
|
||||
q.queue.clear()
|
||||
q.put(data)
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ class DatabaseManagerAttachments(DatabaseManager):
|
|||
for attachment in orphaned:
|
||||
self.log(f"Deleting orphaned attachment: {attachment.name}")
|
||||
session.delete(attachment)
|
||||
self.log(f"Checked for orphaned attachments")
|
||||
self.log("Checked for orphaned attachments")
|
||||
session.commit()
|
||||
return {"status": "success", "deleted_count": len(orphaned)}
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ class DatabaseManagerMessages(DatabaseManager):
|
|||
|
||||
except Exception as e:
|
||||
self.log(f"error fetching database messages with error: {e}", isWarning=True)
|
||||
self.log(f"---> please delete or update existing database", isWarning=True)
|
||||
self.log("---> please delete or update existing database", isWarning=True)
|
||||
|
||||
return []
|
||||
|
||||
|
|
@ -286,7 +286,7 @@ class DatabaseManagerMessages(DatabaseManager):
|
|||
# Set ADIF Fields
|
||||
mode = "DYNAMIC"
|
||||
submode = "FREEDATA"
|
||||
comment = f"QSO via FreeDATA RF-Chat"
|
||||
comment = "QSO via FreeDATA RF-Chat"
|
||||
|
||||
# Gridsquare handling
|
||||
print(origin_info)
|
||||
|
|
@ -562,7 +562,7 @@ class DatabaseManagerMessages(DatabaseManager):
|
|||
self.log(f"Set message {message.id} to queued and incremented attempt")
|
||||
|
||||
session.commit()
|
||||
return {"status": "success", "message": f"message(s) set to queued"}
|
||||
return {"status": "success", "message": "message(s) set to queued"}
|
||||
else:
|
||||
return {"status": "failure", "message": "No eligible messages found"}
|
||||
except Exception as e:
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class DatabaseManagerStations(DatabaseManager):
|
|||
return None
|
||||
except Exception as e:
|
||||
self.log(f"error fetching database station with error: {e}", isWarning=True)
|
||||
self.log(f"---> please delete or update existing database", isWarning=True)
|
||||
self.log("---> please delete or update existing database", isWarning=True)
|
||||
|
||||
return []
|
||||
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class RF:
|
|||
bool: True if audio initialization was successful, False otherwise.
|
||||
"""
|
||||
self.log.info(
|
||||
f"[MDM] init: get audio devices",
|
||||
"[MDM] init: get audio devices",
|
||||
input_device=self.audio_input_device,
|
||||
output_device=self.audio_output_device,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ class P2PConnection:
|
|||
return
|
||||
|
||||
def received_data(self, frame):
|
||||
self.log(f"received data...")
|
||||
self.log("received data...")
|
||||
|
||||
ack_data = self.frame_factory.build_p2p_connection_payload_ack(self.session_id, 0)
|
||||
self.launch_twr_irs(
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ class radio:
|
|||
f"Attempting to start rigctld using binary found at: {binary_path}"
|
||||
)
|
||||
self.rigctld_process = helpers.kill_and_execute(binary_path, additional_args)
|
||||
self.log.info(f"Successfully executed rigctld", args=additional_args)
|
||||
self.log.info("Successfully executed rigctld", args=additional_args)
|
||||
return # Exit the function after successful execution
|
||||
except Exception as e:
|
||||
self.log.warning(
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ class SocketInterfaceHandler:
|
|||
threading.Thread(target=self.data_server.serve_forever, daemon=True).start()
|
||||
self.command_server.command_handler = None
|
||||
|
||||
self.log(f"Interfaces started")
|
||||
self.log("Interfaces started")
|
||||
return self
|
||||
|
||||
def run_server(self, ip, port, handler):
|
||||
|
|
@ -236,4 +236,4 @@ class SocketInterfaceHandler:
|
|||
self.data_server_thread.join(3)
|
||||
del self.data_server
|
||||
|
||||
self.log(f"socket interfaces stopped")
|
||||
self.log("socket interfaces stopped")
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ class SocketCommandHandler:
|
|||
|
||||
cmd = P2PConnectionCommand(self.ctx, params)
|
||||
self.session = cmd.run()
|
||||
self.send_response(f"OK")
|
||||
self.send_response("OK")
|
||||
self.send_response(f"REGISTERED {data[0]}")
|
||||
self.send_response(f"UNENCRYPTED LINK")
|
||||
self.send_response("UNENCRYPTED LINK")
|
||||
self.ctx.socket_interface_manager.connecting_callsign = data[0]
|
||||
# if self.session.session_id:
|
||||
# self.ctx.state_manager.register_p2p_connection_session(self.session)
|
||||
|
|
@ -47,7 +47,7 @@ class SocketCommandHandler:
|
|||
self.send_response(f"ERR: {data}")
|
||||
|
||||
def handle_disconnect(self, data):
|
||||
self.send_response(f"OK")
|
||||
self.send_response("OK")
|
||||
try:
|
||||
self.session.disconnect()
|
||||
except Exception as e:
|
||||
|
|
@ -56,50 +56,50 @@ class SocketCommandHandler:
|
|||
def handle_mycall(self, data):
|
||||
# Storing all of the callsigns assigned by client, to make sure they are checked later in new frames.
|
||||
self.ctx.socket_interface_manager.socket_interface_callsigns = data
|
||||
self.send_response(f"OK")
|
||||
self.send_response(f"UNENCRYPTED LINK")
|
||||
self.send_response(f"ENCRYPTION DISABLED")
|
||||
self.send_response("OK")
|
||||
self.send_response("UNENCRYPTED LINK")
|
||||
self.send_response("ENCRYPTION DISABLED")
|
||||
|
||||
def handle_bw(self, data):
|
||||
# Logic for handling BW command
|
||||
self.ctx.socket_interface_manager.socket_interface_bandwidth = int(data[0])
|
||||
self.send_response(f"OK")
|
||||
self.send_response("OK")
|
||||
|
||||
def handle_abort(self, data):
|
||||
# Logic for handling ABORT command
|
||||
self.send_response(f"OK")
|
||||
self.send_response("OK")
|
||||
try:
|
||||
self.session.abort_connection()
|
||||
except Exception as e:
|
||||
self.send_response(f"ERR: {e}")
|
||||
self.send_response(f"DISCONNECTED")
|
||||
self.send_response("DISCONNECTED")
|
||||
|
||||
def handle_public(self, data):
|
||||
# Logic for handling PUBLIC command
|
||||
self.send_response(f"OK")
|
||||
self.send_response("OK")
|
||||
|
||||
def handle_cwid(self, data):
|
||||
# Logic for handling CWID command
|
||||
self.send_response(f"OK")
|
||||
self.send_response("OK")
|
||||
|
||||
def handle_listen(self, data):
|
||||
# Logic for handling LISTEN command
|
||||
self.send_response(f"OK")
|
||||
self.send_response("OK")
|
||||
|
||||
def handle_compression(self, data):
|
||||
# Logic for handling COMPRESSION command
|
||||
# We are always sending OK, as we have our own compression
|
||||
self.send_response(f"OK")
|
||||
self.send_response("OK")
|
||||
|
||||
def handle_winlink_session(self, data):
|
||||
# Logic for handling WINLINK SESSION command
|
||||
# self.send_response(f"NOT IMPLEMENTED: {data}")
|
||||
self.send_response(f"OK")
|
||||
self.send_response("OK")
|
||||
|
||||
def handle_version(self, data):
|
||||
# Logic for handling VERSION command
|
||||
# maybe we need to use a different version, like 5.0
|
||||
self.send_response(f"VERSION FREEDATA")
|
||||
self.send_response("VERSION FREEDATA")
|
||||
|
||||
def socket_respond_disconnected(self):
|
||||
self.send_response("DISCONNECTED")
|
||||
|
|
@ -111,13 +111,13 @@ class SocketCommandHandler:
|
|||
message = f"CONNECTED {origin} {destination} {bandwidth}"
|
||||
else:
|
||||
message = f"CONNECTED {origin} {destination} {bandwidth}"
|
||||
self.send_response(f"UNENCRYPTED LINK")
|
||||
self.send_response(f"LINK REGISTERED")
|
||||
self.send_response("UNENCRYPTED LINK")
|
||||
self.send_response("LINK REGISTERED")
|
||||
self.send_response(message)
|
||||
|
||||
def socket_respond_iamalive(self):
|
||||
try:
|
||||
self.send_response(f"IAMALIVE")
|
||||
self.send_response("IAMALIVE")
|
||||
except Exception as e:
|
||||
self.log(f"sending iamalive failed {e}")
|
||||
|
||||
|
|
@ -127,8 +127,8 @@ class SocketCommandHandler:
|
|||
def socket_respond_ptt(self, state):
|
||||
"""send the PTT state via command socket"""
|
||||
if state:
|
||||
message = f"PTT ON"
|
||||
message = "PTT ON"
|
||||
else:
|
||||
message = f"PTT OFF"
|
||||
message = "PTT OFF"
|
||||
|
||||
self.send_response(message)
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ def send_wavelog_qso_data(ctx, wavelog_data):
|
|||
response.raise_for_status() # Raise an error for bad status codes
|
||||
log.info(f"[CHAT] Wavelog API: {wavelog_data}")
|
||||
|
||||
callsign_start = wavelog_data.find(f">") + 1
|
||||
callsign_end = wavelog_data.find(f"<QSO_DATE", callsign_start)
|
||||
callsign_start = wavelog_data.find(">") + 1
|
||||
callsign_end = wavelog_data.find("<QSO_DATE", callsign_start)
|
||||
call_value = wavelog_data[callsign_start:callsign_end]
|
||||
|
||||
ctx.event_manager.freedata_logging(
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ class wsm:
|
|||
try:
|
||||
await websocket.receive_text()
|
||||
except Exception as e:
|
||||
self.log.warning(f"Client connection lost", e=e)
|
||||
self.log.warning("Client connection lost", e=e)
|
||||
try:
|
||||
client_list.remove(websocket)
|
||||
except Exception as err:
|
||||
self.log.error(f"Error removing client from list", e=e, err=err)
|
||||
self.log.error("Error removing client from list", e=e, err=err)
|
||||
break
|
||||
|
||||
def transmit_sock_data_worker(self, client_list, event_queue):
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class TestARQSession(unittest.TestCase):
|
|||
# Forward data from Station A to Station B's receive queue
|
||||
if ctx_b:
|
||||
ctx_b.TESTMODE_RECEIVE_QUEUE.put(transmission)
|
||||
self.logger.info(f"Data forwarded to Station B")
|
||||
self.logger.info("Data forwarded to Station B")
|
||||
|
||||
frame_bytes = transmission[1]
|
||||
if len(frame_bytes) == 5:
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class TestMessageProtocol(unittest.TestCase):
|
|||
# Forward data from Station A to Station B's receive queue
|
||||
if ctx_b:
|
||||
ctx_b.TESTMODE_RECEIVE_QUEUE.put(transmission)
|
||||
self.logger.info(f"Data forwarded to Station B")
|
||||
self.logger.info("Data forwarded to Station B")
|
||||
|
||||
frame_bytes = transmission[1]
|
||||
if len(frame_bytes) == 5:
|
||||
|
|
|
|||
Loading…
Reference in New Issue