Skip to content

Commit bef1651

Browse files
Stephanie Wehnerclaude
andcommitted
Fix all linter errors (make lint now exits 0)
- Remove leftover and unused import from qnodeos.py (debugging leftovers) - Remove unnecessary declarations in run.py, start_qnodeos.py, and start_vnode.py — the variable is only read in those scopes, not assigned, so is not needed and flake8 F824 flagged it - Add to the existing noqa comment in protocol.py for the long debug print line - Fix double space after in extendGHZ/bobTest.py (E271) - Add to aligned state constant blocks in eventBased examples and test — alignment is intentional for readability of the dispatch tables - Add to aligned dispatch table entries and assert tuples for the same reason - Remove unused from test_polite_ping_pong.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e828af3 commit bef1651

13 files changed

Lines changed: 21 additions & 28 deletions

File tree

examples/eventBased/politePingPong/politeAlice.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151

5252
# ── States ───────────────────────────────────────────────────────────────────
5353

54-
STATE_WAITING_PONG = "WAITING_PONG"
54+
STATE_WAITING_PONG = "WAITING_PONG" # noqa: E221
5555
STATE_WAITING_YOURE_WELCOME = "WAITING_YOURE_WELCOME"
56-
STATE_DONE = "DONE"
56+
STATE_DONE = "DONE" # noqa: E221
5757

5858

5959
# ── Handlers ─────────────────────────────────────────────────────────────────
@@ -88,7 +88,7 @@ async def handle_youre_welcome(writer: StreamWriter) -> str:
8888
# and anything not listed is automatically an invalid transition.
8989

9090
ALICE_DISPATCH = {
91-
(STATE_WAITING_PONG, "pong"): handle_pong,
91+
(STATE_WAITING_PONG, "pong"): handle_pong, # noqa: E241
9292
(STATE_WAITING_YOURE_WELCOME, "you're welcome"): handle_youre_welcome,
9393
}
9494

examples/eventBased/politePingPong/politeBob.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
# Each constant names a state in Bob's state machine.
4242
# The string value is used in log output so keep it human-readable.
4343

44-
STATE_WAITING_PING = "WAITING_PING"
44+
STATE_WAITING_PING = "WAITING_PING" # noqa: E221
4545
STATE_WAITING_THANKS = "WAITING_THANKS"
46-
STATE_DONE = "DONE"
46+
STATE_DONE = "DONE" # noqa: E221
4747

4848

4949
# ── Handlers ─────────────────────────────────────────────────────────────────
@@ -83,7 +83,7 @@ async def handle_thank_you(writer: StreamWriter) -> str:
8383
# and anything not listed is automatically an invalid transition.
8484

8585
BOB_DISPATCH = {
86-
(STATE_WAITING_PING, "ping"): handle_ping,
86+
(STATE_WAITING_PING, "ping"): handle_ping, # noqa: E241
8787
(STATE_WAITING_THANKS, "thank you"): handle_thank_you,
8888
}
8989

examples/eventBased/quantumCorrRNG/aliceTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
# ── States ───────────────────────────────────────────────────────────────────
4545

4646
STATE_WAITING_ACCEPT = "WAITING_ACCEPT"
47-
STATE_DONE = "DONE"
47+
STATE_DONE = "DONE" # noqa: E221
4848

4949

5050
# ── Handlers ─────────────────────────────────────────────────────────────────

examples/eventBased/quantumCorrRNG/bobTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# ── States ───────────────────────────────────────────────────────────────────
3939

4040
STATE_WAITING_PROPOSAL = "WAITING_PROPOSAL"
41-
STATE_DONE = "DONE"
41+
STATE_DONE = "DONE" # noqa: E221
4242

4343

4444
# ── Handlers ─────────────────────────────────────────────────────────────────

examples/eventBased/quantumCorrRNGVerified/aliceTest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@
5252

5353
# ── States ───────────────────────────────────────────────────────────────────
5454

55-
STATE_WAITING_ACCEPT = "WAITING_ACCEPT"
55+
STATE_WAITING_ACCEPT = "WAITING_ACCEPT" # noqa: E221
5656
STATE_WAITING_VERIFICATION = "WAITING_VERIFICATION"
57-
STATE_DONE = "DONE"
57+
STATE_DONE = "DONE" # noqa: E221
5858

5959

6060
# ── Handlers ─────────────────────────────────────────────────────────────────

examples/eventBased/quantumCorrRNGVerified/bobTest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646

4747
# ── States ───────────────────────────────────────────────────────────────────
4848

49-
STATE_WAITING_PROPOSAL = "WAITING_PROPOSAL"
49+
STATE_WAITING_PROPOSAL = "WAITING_PROPOSAL" # noqa: E221
5050
STATE_WAITING_ALICE_RESULT = "WAITING_ALICE_RESULT"
51-
STATE_DONE = "DONE"
51+
STATE_DONE = "DONE" # noqa: E221
5252

5353
# Bob stores his measurement result here so the verification handler can
5454
# compare it with Alice's result.

examples/new-sdk/extendGHZ/bobTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
async def send_to_charlie(reader: StreamReader, writer: StreamWriter):
2525
writer.write("receive_qubit".encode("utf-8"))
26-
message = await reader.read(100)
26+
message = await reader.read(100)
2727
assert message.decode("utf-8") == "continue"
2828

2929

simulaqron/netqasm_backend/qnodeos.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import sys
32

43
from typing import Optional, Dict, Callable, Generator, Any, List, Type
54

@@ -13,7 +12,6 @@
1312
from simulaqron.netqasm_backend.executioner import VanillaSimulaQronExecutioner
1413
from simulaqron.sdk.connection import (NewMessageType, GetQubitStateMessage,
1514
ReturnQubitStateMessage)
16-
from simulaqron.settings import simulaqron_settings
1715

1816

1917
class SubroutineHandler(QNodeController):

simulaqron/run/run.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ def _worker_initializer(synced_array: SynchronizedArray):
8080

8181

8282
def _app_wrapper(**kwargs):
83-
global _apps_pids
8483
assert _apps_pids is not None
8584
assert "__instance_num" in kwargs and isinstance(kwargs["__instance_num"], int)
8685
assert "__entry_function" in kwargs and isinstance(kwargs["__entry_function"], Callable)
@@ -102,7 +101,6 @@ def _app_wrapper(**kwargs):
102101

103102

104103
def _signal_other_apps():
105-
global _apps_pids
106104
assert _apps_pids is not None
107105
for pid in _apps_pids:
108106
# Do not send SIGINT to self process

simulaqron/sdk/protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ async def _build_server(self):
127127
self._sockets_data.port
128128
)
129129
print(f"{self._node_name.lower()} INFO: === {self._node_name} Server ===")
130-
print(f"{self._node_name.lower()} DEBUG: Listening on {self._sockets_data.hostname}:{self._sockets_data.port}") # noqa: E231
130+
print(f"{self._node_name.lower()} DEBUG: Listening on {self._sockets_data.hostname}:{self._sockets_data.port}") # noqa: E231,E501
131131
async with server:
132132
await server.serve_forever()
133133

0 commit comments

Comments
 (0)