From 8305d89cecd5ce9bec1018e8f29c02825df92f6d Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Wed, 18 Oct 2023 15:21:44 +0100 Subject: [PATCH] merge fix found by flake8 --- spinnman/spalloc/session.py | 8 ++++---- spinnman/spalloc/spalloc_client.py | 4 ++-- spinnman/transceiver/base_transceiver.py | 4 ++-- spinnman/transceiver/mockable_transceiver.py | 2 +- spinnman/transceiver/transceiver.py | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/spinnman/spalloc/session.py b/spinnman/spalloc/session.py index 07c2ddc6f..10a725144 100644 --- a/spinnman/spalloc/session.py +++ b/spinnman/spalloc/session.py @@ -15,10 +15,10 @@ from logging import getLogger import re import requests -from typing import Dict, Tuple, cast, Optional, Union +from typing import Dict, Tuple, cast, Optional import websocket # type: ignore from spinn_utilities.log import FormatAdapter -from spinn_utilities.typing.json import JsonArray, JsonObject +from spinn_utilities.typing.json import JsonObject from .utils import clean_url from spinnman.exceptions import SpallocException @@ -36,7 +36,7 @@ def pp_req(request: requests.PreparedRequest): """ print('{} {}\n{}\r\n{}\r\n\r\n{}'.format( '>>>>>>>>>>>START>>>>>>>>>>>', - request.method + ' ' + request.url, + request.method, request.url, '\r\n'.join('{}: {}'.format(*kv) for kv in request.headers.items()), request.body if request.body else "")) @@ -144,7 +144,7 @@ def get(self, url: str, timeout: int = 10, **kwargs) -> requests.Response: return self.__handle_error_or_return(r) @_may_renew - def post(self, url: str, jsonobj: dict, timeout: int = 10, + def post(self, url: str, json_dict: dict, timeout: int = 10, **kwargs) -> requests.Response: """ Do an HTTP ``POST`` in the session. diff --git a/spinnman/spalloc/spalloc_client.py b/spinnman/spalloc/spalloc_client.py index a7ec1939c..c6e5d4b21 100644 --- a/spinnman/spalloc/spalloc_client.py +++ b/spinnman/spalloc/spalloc_client.py @@ -27,7 +27,7 @@ import threading from typing import ( ContextManager, - Callable, Collection, Dict, FrozenSet, Iterable, Iterator, List, Mapping, + Callable, Dict, FrozenSet, Iterable, Iterator, List, Mapping, Optional, Tuple, cast) from typing_extensions import TypeAlias from websocket import WebSocket # type: ignore @@ -736,7 +736,7 @@ def __init__(self, ws: WebSocket, receiver: _ProxyReceiver): def _open_connection(self) -> int: raise NotImplementedError - def _call(self, proto: ProxyProtocol, packer: struct.Struct, + def _call(self, protocol: ProxyProtocol, packer: struct.Struct, unpacker: struct.Struct, *args) -> List[int]: """ Do a synchronous call. diff --git a/spinnman/transceiver/base_transceiver.py b/spinnman/transceiver/base_transceiver.py index 98b13ad96..6ee18991a 100644 --- a/spinnman/transceiver/base_transceiver.py +++ b/spinnman/transceiver/base_transceiver.py @@ -234,13 +234,13 @@ def bmp_connection(self) -> BMPConnection: @overrides(ExtendableTransceiver.where_is_xy) def where_is_xy(self, x: int, y: int): - try: + try: if SpiNNManDataView.has_machine(): return SpiNNManDataView.get_machine().where_is_xy(x, y) return (f"No Machine. " f"Root IP:{self._scamp_connections[0].remote_ip_address}" f"x:{x} y:{y}") - except Exception as ex: # pylint: disable=broad-except + except Exception as ex: # pylint: disable=broad-except return str(ex) def __identify_connections( diff --git a/spinnman/transceiver/mockable_transceiver.py b/spinnman/transceiver/mockable_transceiver.py index 8f8d985ff..8ab747c7f 100644 --- a/spinnman/transceiver/mockable_transceiver.py +++ b/spinnman/transceiver/mockable_transceiver.py @@ -252,7 +252,7 @@ def send_chip_update_provenance_and_exit(self, x: int, y: int, p: int): pass @overrides(Transceiver.where_is_xy) - def where_is_xy(self, x:int, y:int): + def where_is_xy(self, x: int, y: int): return f"Mocked {x=} {y=}" @property diff --git a/spinnman/transceiver/transceiver.py b/spinnman/transceiver/transceiver.py index ad4d3a3b0..f268e5b86 100644 --- a/spinnman/transceiver/transceiver.py +++ b/spinnman/transceiver/transceiver.py @@ -979,7 +979,7 @@ def send_chip_update_provenance_and_exit(self, x: int, y: int, p: int): raise NotImplementedError("abstractmethod") @abstractmethod - def where_is_xy(self, x:int, y:int): + def where_is_xy(self, x: int, y: int): """ Attempts to get where_is_x_y info from the machine