Skip to content

Commit

Permalink
remove default values
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian-B committed Nov 26, 2024
1 parent 3559c01 commit b9c9f2b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
5 changes: 3 additions & 2 deletions spalloc_client/protocol_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
import socket
from types import TracebackType
from typing import cast, Dict, Literal, Optional, Type, Union
from typing_extensions import Self
from threading import current_thread, RLock, local, Thread

from typing_extensions import Self

from spinn_utilities.typing.json import (
JsonObject, JsonObjectArray, JsonValue)

Expand Down Expand Up @@ -278,7 +279,7 @@ def _send_json(
except socket.timeout as e:
raise ProtocolTimeoutError("send timed out.") from e

def call(self, name: str, timeout: Optional[float] = None,
def call(self, name: str, timeout: Optional[float],
*args: Union[int, str, None],
**kwargs: JsonValue) -> JsonValue:
""" Send a command to the server and return the reply.
Expand Down
2 changes: 1 addition & 1 deletion spalloc_client/scripts/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def show_job_info(t: Terminal, client: ProtocolClient, timeout: Optional[int],
t.dim(" . "),
tuple(map(t.dim, DEFAULT_BOARD_EDGES)),
tuple(map(t.bright, DEFAULT_BOARD_EDGES)),
)])
)], [])

if machine_info["connections"] is not None:
connections = cast(list, machine_info["connections"])
Expand Down
4 changes: 2 additions & 2 deletions spalloc_client/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def update(self, string: str = "", start_again: bool = False) -> str:
# Restore to previous location and clear line.
return "".join((self("\0338\033[K"), str(string)))

def set_attrs(self, attrs: List = []) -> str:
def set_attrs(self, attrs: List) -> str:
""" Construct an ANSI control sequence which sets the given attribute\
numbers.
"""
Expand Down Expand Up @@ -380,7 +380,7 @@ def _board_to_cartesian(x: int, y: int, z: int) -> Tuple[int, int]:
def render_boards(
board_groups: List[Tuple[List[Tuple[int, int, int]], str,
Tuple[str, str, str], Tuple[str, str, str]]],
dead_links: List = [],
dead_links: List,
dead_edge: Tuple[str, str, str] = ("XXX", "X", "X"),
blank_label: str = " ",
blank_edge: Tuple[str, str, str] = (" ", " ", " ")) -> str:
Expand Down
14 changes: 7 additions & 7 deletions tests/test_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_set_attr():
t = Terminal(force=True)

# Empty list
assert t.set_attrs() == ""
assert t.set_attrs([]) == ""

# Single item
assert t.set_attrs([1]) == "\033[1m"
Expand All @@ -87,7 +87,7 @@ def test_set_attr():

# When disabled should do nothing
t.enabled = False
assert t.set_attrs() == ""
assert t.set_attrs([]) == ""
assert t.set_attrs([1]) == ""
assert t.set_attrs([1, 2, 3]) == ""

Expand Down Expand Up @@ -215,12 +215,12 @@ def test_render_definitions():
class TestRenderBoards(object):

def test_empty(self):
assert render_boards([]) == ""
assert render_boards([], []) == ""

def test_single(self):
out = render_boards([
([(0, 0, 0)], "ABC", INNER_BOARD_EDGES, OUTER_BOARD_EDGES),
])
], [])
assert out == (r" ___."
r"/ABC\."
r"\___/".replace(".", "\n"))
Expand All @@ -229,7 +229,7 @@ def test_three_boards(self):
out = render_boards([
([(0, 0, z) for z in range(3)], "ABC",
INNER_BOARD_EDGES, OUTER_BOARD_EDGES),
])
], [])
assert out == (r" ___."
r"/ABC\___."
r"\===,ABC\."
Expand All @@ -244,7 +244,7 @@ def test_many_boards(self):
for y in range(2)
for z in range(3)], "ABC",
INNER_BOARD_EDGES, OUTER_BOARD_EDGES),
])
], [])
assert out == (r" ___ ___."
r"/ABC\___/ABC\___."
r"\===,ABC`===,ABC\."
Expand Down Expand Up @@ -286,7 +286,7 @@ def test_multiple_board_groups(self):
for x in range(2) for y in range(2) for z in range(3)
if (x, y) != (0, 0)], "ABC",
INNER_BOARD_EDGES, OUTER_BOARD_EDGES),
])
], [])
assert out == (r" ___ ___."
r"/ABC\___/ABC\___."
r"\===,ABC`===,ABC\."
Expand Down

0 comments on commit b9c9f2b

Please sign in to comment.