turn mypy checks back on, fix some errors

This commit is contained in:
pacrob
2024-04-27 09:41:56 -06:00
committed by Paul Robinson
parent f0fbd2d8c8
commit 8dda7b933e
11 changed files with 39 additions and 33 deletions

View File

@ -83,9 +83,7 @@ class SwarmConn(INetConn):
async def _handle_muxed_stream(self, muxed_stream: IMuxedStream) -> None:
net_stream = await self._add_stream(muxed_stream)
try:
# Ignore type here since mypy complains:
# https://github.com/python/mypy/issues/2427
await self.swarm.common_stream_handler(net_stream) # type: ignore
await self.swarm.common_stream_handler(net_stream)
finally:
# As long as `common_stream_handler`, remove the stream.
self.remove_stream(net_stream)

View File

@ -113,9 +113,7 @@ class Swarm(Service, INetworkService):
# Create Notifee array
self.notifees = []
# Ignore type here since mypy complains:
# https://github.com/python/mypy/issues/2427
self.common_stream_handler = create_default_stream_handler(self) # type: ignore
self.common_stream_handler = create_default_stream_handler(self)
self.listener_nursery = None
self.event_listener_nursery_created = trio.Event()
@ -137,9 +135,7 @@ class Swarm(Service, INetworkService):
return self.self_id
def set_stream_handler(self, stream_handler: StreamHandlerFn) -> None:
# Ignore type here since mypy complains:
# https://github.com/python/mypy/issues/2427
self.common_stream_handler = stream_handler # type: ignore
self.common_stream_handler = stream_handler
async def dial_peer(self, peer_id: ID) -> INetConn:
"""
@ -273,7 +269,7 @@ class Swarm(Service, INetworkService):
return True
async def conn_handler(
read_write_closer: ReadWriteCloser, maddr=maddr
read_write_closer: ReadWriteCloser, maddr: Multiaddr = maddr
) -> None:
raw_conn = RawConnection(read_write_closer, False)