From 544b5bdd9c70b0bf6ddbdc8f55fd6c16602be5a7 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 30 Mar 2025 22:42:51 -0400 Subject: [PATCH] Slight typing and multi-line styling tweaks in `.ipc` sugpkg --- tractor/ipc/_shm.py | 5 ++++- tractor/ipc/_transport.py | 5 ++++- tractor/ipc/_types.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tractor/ipc/_shm.py b/tractor/ipc/_shm.py index 9868ac73..62b26e79 100644 --- a/tractor/ipc/_shm.py +++ b/tractor/ipc/_shm.py @@ -50,7 +50,10 @@ if _USE_POSIX: try: import numpy as np from numpy.lib import recfunctions as rfn - import nptyping + # TODO ruff complains with, + # warning| F401: `nptyping` imported but unused; consider using + # `importlib.util.find_spec` to test for availability + import nptyping # noqa except ImportError: pass diff --git a/tractor/ipc/_transport.py b/tractor/ipc/_transport.py index 1440d453..9dd09a9b 100644 --- a/tractor/ipc/_transport.py +++ b/tractor/ipc/_transport.py @@ -157,7 +157,10 @@ class MsgpackTransport(MsgTransport): ) -> None: self.stream = stream - self._laddr, self._raddr = self.get_stream_addrs(stream) + ( + self._laddr, + self._raddr, + ) = self.get_stream_addrs(stream) # create read loop instance self._aiter_pkts = self._iter_packets() diff --git a/tractor/ipc/_types.py b/tractor/ipc/_types.py index 3e0e43e5..1b86636d 100644 --- a/tractor/ipc/_types.py +++ b/tractor/ipc/_types.py @@ -76,7 +76,7 @@ def transport_from_stream( ''' transport = None if isinstance(stream, trio.SocketStream): - sock = stream.socket + sock: socket.socket = stream.socket match sock.family: case socket.AF_INET | socket.AF_INET6: transport = 'tcp'