mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
run lint with pyupgrade at py39-plus
This commit is contained in:
@ -1,9 +1,6 @@
|
||||
from abc import (
|
||||
abstractmethod,
|
||||
)
|
||||
from typing import (
|
||||
Tuple,
|
||||
)
|
||||
|
||||
import trio
|
||||
|
||||
@ -27,5 +24,5 @@ class INetConn(Closer):
|
||||
...
|
||||
|
||||
@abstractmethod
|
||||
def get_streams(self) -> Tuple[INetStream, ...]:
|
||||
def get_streams(self) -> tuple[INetStream, ...]:
|
||||
...
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Set,
|
||||
Tuple,
|
||||
)
|
||||
|
||||
import trio
|
||||
@ -32,7 +30,7 @@ Reference: https://github.com/libp2p/go-libp2p-swarm/blob/04c86bbdafd390651cb2ee
|
||||
class SwarmConn(INetConn):
|
||||
muxed_conn: IMuxedConn
|
||||
swarm: "Swarm"
|
||||
streams: Set[NetStream]
|
||||
streams: set[NetStream]
|
||||
event_closed: trio.Event
|
||||
|
||||
def __init__(self, muxed_conn: IMuxedConn, swarm: "Swarm") -> None:
|
||||
@ -104,7 +102,7 @@ class SwarmConn(INetConn):
|
||||
muxed_stream = await self.muxed_conn.open_stream()
|
||||
return await self._add_stream(muxed_stream)
|
||||
|
||||
def get_streams(self) -> Tuple[NetStream, ...]:
|
||||
def get_streams(self) -> tuple[NetStream, ...]:
|
||||
return tuple(self.streams)
|
||||
|
||||
def remove_stream(self, stream: NetStream) -> None:
|
||||
|
||||
Reference in New Issue
Block a user