From b9c9f2be0b4bd4cc1442b616d13faa691e7c51d3 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Tue, 26 Nov 2024 06:44:34 +0000 Subject: [PATCH] remove default values --- spalloc_client/protocol_client.py | 5 +++-- spalloc_client/scripts/job.py | 2 +- spalloc_client/term.py | 4 ++-- tests/test_term.py | 14 +++++++------- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/spalloc_client/protocol_client.py b/spalloc_client/protocol_client.py index 2b172ed2d..4c3bf1b36 100644 --- a/spalloc_client/protocol_client.py +++ b/spalloc_client/protocol_client.py @@ -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) @@ -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. diff --git a/spalloc_client/scripts/job.py b/spalloc_client/scripts/job.py index 040565f98..2d8cb6a05 100644 --- a/spalloc_client/scripts/job.py +++ b/spalloc_client/scripts/job.py @@ -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"]) diff --git a/spalloc_client/term.py b/spalloc_client/term.py index 6648b0908..e9285cb9c 100644 --- a/spalloc_client/term.py +++ b/spalloc_client/term.py @@ -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. """ @@ -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: diff --git a/tests/test_term.py b/tests/test_term.py index 0d6a9a45b..ae07dba7f 100644 --- a/tests/test_term.py +++ b/tests/test_term.py @@ -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" @@ -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]) == "" @@ -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")) @@ -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\." @@ -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\." @@ -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\."