From 856dfc4ae067846d00c09e7af321fa1c31455936 Mon Sep 17 00:00:00 2001 From: Andrew Rowley Date: Tue, 23 Jul 2024 08:09:37 +0100 Subject: [PATCH] mypy fixes --- spinnman/spalloc/spalloc_client.py | 1 + spinnman/utilities/locate_connected_machine_ip_address.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spinnman/spalloc/spalloc_client.py b/spinnman/spalloc/spalloc_client.py index 1bc37d9fa..53c036710 100644 --- a/spinnman/spalloc/spalloc_client.py +++ b/spinnman/spalloc/spalloc_client.py @@ -145,6 +145,7 @@ def get_job(self, job_id: str) -> SpallocJob: :param str job_id: The job id. :rtype: SpallocJob """ + assert self.__session return _SpallocJob( self.__session, fix_url(f"{self.__jobs_url}/{job_id}")) diff --git a/spinnman/utilities/locate_connected_machine_ip_address.py b/spinnman/utilities/locate_connected_machine_ip_address.py index eaa734033..6ed26c419 100644 --- a/spinnman/utilities/locate_connected_machine_ip_address.py +++ b/spinnman/utilities/locate_connected_machine_ip_address.py @@ -20,7 +20,7 @@ from spinnman.connections.udp_packet_connections import IPAddressesConnection -def locate_connected_machine(handler: Callable[[str, float], None]): +def locate_connected_machine(handler: Callable[[str, float], bool]): """ Locates any SpiNNaker machines IP addresses from the auto-transmitted packets from non-booted SpiNNaker machines. @@ -51,7 +51,7 @@ def _ctrlc_handler(sig, frame): print("Exiting") sys.exit() - def _print_connected(ip_address: str, timestamp: float): + def _print_connected(ip_address: str, timestamp: float) -> bool: try: hostname = f" ({socket.gethostbyaddr(ip_address)[0]})" except Exception: # pylint: disable=broad-except