diff --git a/libp2p/__init__.py b/libp2p/__init__.py index 9e452ca..08caf25 100644 --- a/libp2p/__init__.py +++ b/libp2p/__init__.py @@ -1,5 +1,5 @@ import asyncio -from typing import Mapping, Sequence +from typing import Sequence from libp2p.crypto.keys import KeyPair from libp2p.crypto.rsa import create_new_key_pair @@ -15,10 +15,9 @@ from libp2p.routing.interfaces import IPeerRouting from libp2p.routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter from libp2p.security.insecure.transport import PLAINTEXT_PROTOCOL_ID, InsecureTransport import libp2p.security.secio.transport as secio -from libp2p.security.secure_transport_interface import ISecureTransport from libp2p.stream_muxer.mplex.mplex import MPLEX_PROTOCOL_ID, Mplex from libp2p.transport.tcp.tcp import TCP -from libp2p.transport.typing import TMuxerClass, TMuxerOptions, TSecurityOptions +from libp2p.transport.typing import TMuxerOptions, TSecurityOptions from libp2p.transport.upgrader import TransportUpgrader from libp2p.typing import TProtocol diff --git a/libp2p/security/security_multistream.py b/libp2p/security/security_multistream.py index 06f4b8a..cff55af 100644 --- a/libp2p/security/security_multistream.py +++ b/libp2p/security/security_multistream.py @@ -31,14 +31,13 @@ class SecurityMultistream(ABC): multiselect: Multiselect multiselect_client: MultiselectClient - def __init__(self, secure_transports_by_protocol: TSecurityOptions = None) -> None: + def __init__(self, secure_transports_by_protocol: TSecurityOptions) -> None: self.transports = OrderedDict() self.multiselect = Multiselect() self.multiselect_client = MultiselectClient() - if secure_transports_by_protocol is not None: - for protocol, transport in secure_transports_by_protocol.items(): - self.add_transport(protocol, transport) + for protocol, transport in secure_transports_by_protocol.items(): + self.add_transport(protocol, transport) def add_transport(self, protocol: TProtocol, transport: ISecureTransport) -> None: """ diff --git a/libp2p/stream_muxer/muxer_multistream.py b/libp2p/stream_muxer/muxer_multistream.py index d506749..7f6ee07 100644 --- a/libp2p/stream_muxer/muxer_multistream.py +++ b/libp2p/stream_muxer/muxer_multistream.py @@ -26,13 +26,12 @@ class MuxerMultistream: multiselect: Multiselect multiselect_client: MultiselectClient - def __init__(self, muxer_transports_by_protocol: TMuxerOptions = None) -> None: + def __init__(self, muxer_transports_by_protocol: TMuxerOptions) -> None: self.transports = OrderedDict() self.multiselect = Multiselect() self.multiselect_client = MultiselectClient() - if muxer_transports_by_protocol is not None: - for protocol, transport in muxer_transports_by_protocol.items(): - self.add_transport(protocol, transport) + for protocol, transport in muxer_transports_by_protocol.items(): + self.add_transport(protocol, transport) def add_transport(self, protocol: TProtocol, transport: TMuxerClass) -> None: """