diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-19 14:24:13 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-19 14:24:13 +0200 |
| commit | 86188385cbdae1ee90c1dca7a7b9db2edef1ecd4 (patch) | |
| tree | cc01153f05e84ad6cd34556caecd3f4bc335d0bd /poc/spike5_node.py | |
| parent | d2495a2c4b89fbbfc18cefec83ae96cabdd745e2 (diff) | |
| download | meshbay-86188385cbdae1ee90c1dca7a7b9db2edef1ecd4.tar.gz | |
style: ruff's own fixes, mechanically applied
`ruff check .` had gone unrun long enough to report 568 errors, which is the
same as having no linter: the next real finding would have been invisible in the
noise. This is the 521 it fixes by itself, in 173 files, and nothing else — the
98 it cannot fix are the next commit.
What actually changed: import sorting (225), imports nobody used (87, none of
them a re-export — no `__init__.py` is touched, which was the one way this could
have broken an import elsewhere), `datetime.timezone.utc` to `datetime.UTC` (69)
and `asyncio.TimeoutError` to `TimeoutError` (18), both plain aliases on the 3.12
this project requires, `Optional[X]` to `X | None` (24), and f-strings with
nothing to interpolate (19).
Checked rather than assumed: every module in the three packages still imports,
and the suite is 2893 passed — the same count, test for test, as the merge
before it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'poc/spike5_node.py')
| -rw-r--r-- | poc/spike5_node.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/poc/spike5_node.py b/poc/spike5_node.py index 6104e00..b560dc1 100644 --- a/poc/spike5_node.py +++ b/poc/spike5_node.py @@ -14,13 +14,19 @@ Note: node initiates the TCP connection (reversed for POC — in production, the QUIC client connects to the node using the hole-punching from Spike 4). """ -import asyncio, json, base64, struct, os, time +import asyncio +import base64 +import json +import os +import struct +import time from pathlib import Path + +import blake3 +from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305 from cryptography.hazmat.primitives.kdf.hkdf import HKDF -from cryptography.hazmat.primitives import hashes, serialization -import blake3 MESHBAY_HOST = "meshbay.org" MESHBAY_PORT = 19003 @@ -125,7 +131,7 @@ async def main(): print(f" {PASS} Test file: {TEST_FILE} ({file_size/1024/1024:.1f} MB)") # Pre-compute file hash (used in HKDF info string — identifies the file) - print(f" Computing file hash...") + print(" Computing file hash...") t0 = time.perf_counter() file_hash = blake3.blake3(TEST_FILE.read_bytes()).digest() print(f" {PASS} File hash: {file_hash.hex()[:16]}... ({(time.perf_counter()-t0)*1000:.0f}ms)") @@ -166,7 +172,7 @@ async def main(): print(f" {PASS} Sent {payload_kb:.1f} KB in {send_ms:.0f}ms ({throughput:.1f} MB/s)") print(f"\n {'='*50}") - print(f" Timings (node side):") + print(" Timings (node side):") print(f" Encrypt + sign : {enc_ms:.1f} ms") print(f" TCP send : {send_ms:.0f} ms") print(f" Total : {total_ms:.0f} ms") |