run lint with pyupgrade at py39-plus

This commit is contained in:
pacrob
2025-01-25 15:31:51 -07:00
committed by Paul Robinson
parent 20580b9a4e
commit 8787613e91
44 changed files with 221 additions and 240 deletions

View File

@ -2,9 +2,6 @@ from abc import (
ABC,
abstractmethod,
)
from typing import (
Tuple,
)
from multiaddr import (
Multiaddr,
@ -23,7 +20,7 @@ class IListener(ABC):
"""
@abstractmethod
def get_addrs(self) -> Tuple[Multiaddr, ...]:
def get_addrs(self) -> tuple[Multiaddr, ...]:
"""
Retrieve list of addresses the listener is listening on.

View File

@ -1,10 +1,10 @@
from collections.abc import (
Awaitable,
Sequence,
)
import logging
from typing import (
Awaitable,
Callable,
List,
Sequence,
Tuple,
)
from multiaddr import (
@ -41,7 +41,7 @@ logger = logging.getLogger("libp2p.transport.tcp")
class TCPListener(IListener):
listeners: List[trio.SocketListener]
listeners: list[trio.SocketListener]
def __init__(self, handler_function: THandler) -> None:
self.listeners = []
@ -78,7 +78,7 @@ class TCPListener(IListener):
)
self.listeners.extend(listeners)
def get_addrs(self) -> Tuple[Multiaddr, ...]:
def get_addrs(self) -> tuple[Multiaddr, ...]:
"""
Retrieve list of addresses the listener is listening on.

View File

@ -1,8 +1,9 @@
from typing import (
from collections.abc import (
Awaitable,
Callable,
Mapping,
Type,
)
from typing import (
Callable,
)
from libp2p.io.abc import (
@ -20,5 +21,5 @@ from libp2p.typing import (
THandler = Callable[[ReadWriteCloser], Awaitable[None]]
TSecurityOptions = Mapping[TProtocol, ISecureTransport]
TMuxerClass = Type[IMuxedConn]
TMuxerClass = type[IMuxedConn]
TMuxerOptions = Mapping[TProtocol, TMuxerClass]