mirror of https://github.com/DJ2LS/FreeDATA.git
Executed `ruff format --preview`, small update to CONTRIBUTING.md
parent
90a1e7c2f7
commit
191c94c942
|
|
@ -41,9 +41,12 @@ The python sources must be formatted and checked using `ruff`. There is a CI
|
|||
workflow that block all PRs that do not pass the linter/formatter checks.
|
||||
|
||||
- To check formatting run `ruff format --check` (lists file that needs formatting)
|
||||
- To see what the automatic formatter will change run `ruff format --diff` (shows
|
||||
diff-style changes).
|
||||
- To automatically format files run `ruff format`
|
||||
- To see what the automatic formatter will change run `ruff format --preview
|
||||
--diff` (shows diff-style changes).
|
||||
- To automatically format files run `ruff format --preview`
|
||||
|
||||
NOTE: the `--preview` enables new auto-formatting actions and enables a feature
|
||||
usefull in the CI. In the future it will no longer be necessary
|
||||
|
||||
- To run the checker/linter execute `ruff check`
|
||||
- Some errors can be automatically fixed running `ruff check --fix`, but always
|
||||
|
|
|
|||
|
|
@ -55,9 +55,10 @@ class CircularBuffer:
|
|||
if n <= end_space:
|
||||
result = self.buffer[self.head : self.head + n].copy()
|
||||
else:
|
||||
result = np.concatenate(
|
||||
(self.buffer[self.head :].copy(), self.buffer[: n - end_space].copy())
|
||||
)
|
||||
result = np.concatenate((
|
||||
self.buffer[self.head :].copy(),
|
||||
self.buffer[: n - end_space].copy(),
|
||||
))
|
||||
# Update head and count.
|
||||
self.head = (self.head + n) % self.size
|
||||
self.nbuffer -= n
|
||||
|
|
|
|||
|
|
@ -278,6 +278,9 @@ class EventManager:
|
|||
message (str): The message to be displayed
|
||||
"""
|
||||
|
||||
self.broadcast(
|
||||
{"type": "message-logging", "endpoint": type, "status": status, "message": message}
|
||||
)
|
||||
self.broadcast({
|
||||
"type": "message-logging",
|
||||
"endpoint": type,
|
||||
"status": status,
|
||||
"message": message,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -87,15 +87,13 @@ class Explorer:
|
|||
except Exception as e:
|
||||
snr = "N/A"
|
||||
log.warning("[EXPLORER] SNR parsing failed", e=e)
|
||||
station_data["lastheard"].append(
|
||||
{
|
||||
"callsign": callsign,
|
||||
"grid": grid,
|
||||
"snr": snr,
|
||||
"timestamp": timestamp,
|
||||
"frequency": frequency,
|
||||
}
|
||||
)
|
||||
station_data["lastheard"].append({
|
||||
"callsign": callsign,
|
||||
"grid": grid,
|
||||
"snr": snr,
|
||||
"timestamp": timestamp,
|
||||
"frequency": frequency,
|
||||
})
|
||||
except Exception as e:
|
||||
log.debug("[EXPLORER] not publishing station", e=e)
|
||||
station_data = json.dumps(station_data)
|
||||
|
|
|
|||
|
|
@ -141,15 +141,13 @@ class DatabaseManagerBeacon(DatabaseManager):
|
|||
station.location.get("gridsquare") if station and station.location else None
|
||||
)
|
||||
|
||||
beacons_list.append(
|
||||
{
|
||||
"id": beacon.id,
|
||||
"timestamp": beacon.timestamp.isoformat(),
|
||||
"snr": beacon.snr,
|
||||
"callsign": beacon.callsign,
|
||||
"gridsquare": gridsquare,
|
||||
}
|
||||
)
|
||||
beacons_list.append({
|
||||
"id": beacon.id,
|
||||
"timestamp": beacon.timestamp.isoformat(),
|
||||
"snr": beacon.snr,
|
||||
"callsign": beacon.callsign,
|
||||
"gridsquare": gridsquare,
|
||||
})
|
||||
|
||||
return beacons_list
|
||||
|
||||
|
|
|
|||
|
|
@ -89,13 +89,11 @@ class TestDatabaseMessageSystem(unittest.TestCase):
|
|||
def test_get_attachments(self):
|
||||
attachments = []
|
||||
for i in range(3):
|
||||
attachments.append(
|
||||
{
|
||||
"name": f"test{i}.gif",
|
||||
"type": "image/gif",
|
||||
"data": str(base64.b64encode(np.random.bytes(1024)), "utf-8"),
|
||||
}
|
||||
)
|
||||
attachments.append({
|
||||
"name": f"test{i}.gif",
|
||||
"type": "image/gif",
|
||||
"data": str(base64.b64encode(np.random.bytes(1024)), "utf-8"),
|
||||
})
|
||||
|
||||
apiParams = {"destination": "DJ2LS-3", "body": "Hello World!", "attachments": attachments}
|
||||
message = MessageP2P.from_api_params(self.mycall, apiParams)
|
||||
|
|
|
|||
|
|
@ -35,12 +35,10 @@ class TestModem:
|
|||
tx_time = self.getFrameTransmissionTime(mode) + 0.1
|
||||
self.logger.info(f"TX {tx_time} seconds...")
|
||||
threading.Event().wait(tx_time)
|
||||
self.data_queue_received.put(
|
||||
{
|
||||
"mode": mode,
|
||||
"bytes": frames,
|
||||
}
|
||||
)
|
||||
self.data_queue_received.put({
|
||||
"mode": mode,
|
||||
"bytes": frames,
|
||||
})
|
||||
|
||||
|
||||
class TestP2PConnectionSession(unittest.TestCase):
|
||||
|
|
|
|||
|
|
@ -155,9 +155,14 @@ def test_freedv_mode_pairs(mode_pairs, config_file="config.ini"):
|
|||
avg_volume_db, max_possible_volume_db, papr, freqs, fft_values = (
|
||||
freedv_tx.compute_audio_metrics(txbuffer)
|
||||
)
|
||||
results.append(
|
||||
(test_tx.name, test_rx.name, result, avg_volume_db, max_possible_volume_db, papr)
|
||||
)
|
||||
results.append((
|
||||
test_tx.name,
|
||||
test_rx.name,
|
||||
result,
|
||||
avg_volume_db,
|
||||
max_possible_volume_db,
|
||||
papr,
|
||||
))
|
||||
volume_per_mode[test_tx.name] = avg_volume_db
|
||||
max_volume_per_mode[test_tx.name] = max_possible_volume_db
|
||||
papr_per_mode[test_tx.name] = papr
|
||||
|
|
|
|||
Loading…
Reference in New Issue