Slight typing and multi-line styling tweaks in `.ipc` sugpkg

ns_aware
Tyler Goodlet 2025-03-30 22:42:51 -04:00
parent e904af679b
commit 08ac89b807
4 changed files with 9 additions and 5 deletions

View File

@ -478,7 +478,6 @@ async def attach_to_ringbuf_stream(
yield trio.StapledStream(sender, receiver) yield trio.StapledStream(sender, receiver)
class RingBuffBytesSender(trio.abc.SendChannel[bytes]): class RingBuffBytesSender(trio.abc.SendChannel[bytes]):
''' '''
In order to guarantee full messages are received, all bytes In order to guarantee full messages are received, all bytes
@ -522,7 +521,6 @@ class RingBuffBytesSender(trio.abc.SendChannel[bytes]):
if self._batch_msg_len == self.batch_size: if self._batch_msg_len == self.batch_size:
await self.flush() await self.flush()
async def aclose(self) -> None: async def aclose(self) -> None:
await self._sender.aclose() await self._sender.aclose()

View File

@ -50,7 +50,10 @@ if _USE_POSIX:
try: try:
import numpy as np import numpy as np
from numpy.lib import recfunctions as rfn 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: except ImportError:
pass pass

View File

@ -157,7 +157,10 @@ class MsgpackTransport(MsgTransport):
) -> None: ) -> None:
self.stream = stream 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 # create read loop instance
self._aiter_pkts = self._iter_packets() self._aiter_pkts = self._iter_packets()

View File

@ -76,7 +76,7 @@ def transport_from_stream(
''' '''
transport = None transport = None
if isinstance(stream, trio.SocketStream): if isinstance(stream, trio.SocketStream):
sock = stream.socket sock: socket.socket = stream.socket
match sock.family: match sock.family:
case socket.AF_INET | socket.AF_INET6: case socket.AF_INET | socket.AF_INET6:
transport = 'tcp' transport = 'tcp'