Improve import layout
This commit is contained in:
parent
e7ac09cb94
commit
a4a0d79f6d
|
@ -8,27 +8,15 @@ from typing import (
|
|||
|
||||
import multiaddr
|
||||
|
||||
from .host_interface import (
|
||||
IHost,
|
||||
)
|
||||
from libp2p.network.swarm import (
|
||||
Swarm
|
||||
)
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.peer.peerinfo import (
|
||||
PeerInfo,
|
||||
)
|
||||
from libp2p.peer.peerstore import (
|
||||
PeerStore,
|
||||
)
|
||||
from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
from libp2p.routing.kademlia.kademlia_peer_router import (
|
||||
KadmeliaPeerRouter,
|
||||
)
|
||||
from libp2p.network.swarm import Swarm
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.peer.peerinfo import PeerInfo
|
||||
from libp2p.peer.peerstore import PeerStore
|
||||
|
||||
from libp2p.network.stream.net_stream_interface import INetStream
|
||||
from libp2p.routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter
|
||||
|
||||
from .host_interface import IHost
|
||||
|
||||
# Upon host creation, host takes in options,
|
||||
# including the list of addresses on which to listen.
|
||||
|
|
|
@ -9,24 +9,13 @@ from typing import (
|
|||
|
||||
import multiaddr
|
||||
|
||||
from libp2p.network.swarm import (
|
||||
Swarm
|
||||
)
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.peer.peerinfo import (
|
||||
PeerInfo,
|
||||
)
|
||||
from libp2p.peer.peerstore import (
|
||||
PeerStore,
|
||||
)
|
||||
from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
from libp2p.routing.kademlia.kademlia_peer_router import (
|
||||
KadmeliaPeerRouter,
|
||||
)
|
||||
from libp2p.network.swarm import Swarm
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.peer.peerinfo import PeerInfo
|
||||
from libp2p.peer.peerstore import PeerStore
|
||||
|
||||
from libp2p.network.stream.net_stream_interface import INetStream
|
||||
from libp2p.routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter
|
||||
|
||||
|
||||
class IHost(ABC):
|
||||
|
|
|
@ -8,12 +8,11 @@ from typing import (
|
|||
|
||||
from multiaddr import Multiaddr
|
||||
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||
|
||||
from .notifee_interface import INotifee
|
||||
from .stream.net_stream import NetStream
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||
|
||||
|
||||
class INetwork(ABC):
|
||||
|
|
|
@ -3,9 +3,10 @@ from abc import ABC, abstractmethod
|
|||
from multiaddr import Multiaddr
|
||||
|
||||
from libp2p.network.network_interface import INetwork
|
||||
from libp2p.network.stream.net_stream_interface import INetStream
|
||||
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||
|
||||
from libp2p.network.stream.net_stream_interface import INetStream
|
||||
|
||||
|
||||
class INotifee(ABC):
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from .net_stream_interface import INetStream
|
||||
from libp2p.stream_muxer.mplex.mplex_stream import MplexStream
|
||||
from libp2p.stream_muxer.mplex.mplex import Mplex
|
||||
from libp2p.stream_muxer.mplex.mplex_stream import MplexStream
|
||||
|
||||
from .net_stream_interface import INetStream
|
||||
|
||||
|
||||
class NetStream(INetStream):
|
||||
|
|
|
@ -10,10 +10,6 @@ from typing import (
|
|||
|
||||
from multiaddr import Multiaddr
|
||||
|
||||
from .network_interface import INetwork
|
||||
from .notifee_interface import INotifee
|
||||
from .connection.raw_connection import RawConnection
|
||||
from .stream.net_stream import NetStream
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
id_b58_decode,
|
||||
|
@ -25,9 +21,15 @@ from libp2p.routing.interfaces import IPeerRouting
|
|||
from libp2p.transport.upgrader import TransportUpgrader
|
||||
from libp2p.transport.transport_interface import ITransport
|
||||
from libp2p.transport.listener_interface import IListener
|
||||
from libp2p.stream_muxer.mplex.mplex_stream import MplexStream
|
||||
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||
|
||||
from libp2p.stream_muxer.mplex.mplex_stream import MplexStream
|
||||
|
||||
from .network_interface import INetwork
|
||||
from .notifee_interface import INotifee
|
||||
from .connection.raw_connection import RawConnection
|
||||
from .stream.net_stream import NetStream
|
||||
|
||||
|
||||
class Swarm(INetwork):
|
||||
# pylint: disable=too-many-instance-attributes,cell-var-from-loop,too-many-arguments
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import hashlib
|
||||
from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
from Crypto.PublicKey.RSA import (
|
||||
RsaKey,
|
||||
)
|
||||
import hashlib
|
||||
import base58
|
||||
|
||||
import multihash
|
||||
|
||||
from Crypto.PublicKey.RSA import RsaKey
|
||||
|
||||
# MaxInlineKeyLength is the maximum length a key can be for it to be inlined in
|
||||
# the peer ID.
|
||||
# * When `len(pubKey.Bytes()) <= MaxInlineKeyLength`, the peer ID is the
|
||||
|
|
|
@ -9,9 +9,9 @@ from typing import (
|
|||
from multiaddr import Multiaddr
|
||||
|
||||
from .id import ID
|
||||
from .peerstore_interface import IPeerStore
|
||||
from .peerdata import PeerData
|
||||
from .peerinfo import PeerInfo
|
||||
from .peerstore_interface import IPeerStore
|
||||
|
||||
|
||||
class PeerStore(IPeerStore):
|
||||
|
|
|
@ -5,9 +5,9 @@ from typing import (
|
|||
)
|
||||
|
||||
|
||||
from .addrbook_interface import IAddrBook
|
||||
from .id import ID
|
||||
from .peerinfo import PeerInfo
|
||||
from .addrbook_interface import IAddrBook
|
||||
from .peermetadata_interface import IPeerMetadata
|
||||
|
||||
|
||||
|
|
|
@ -12,9 +12,6 @@ from libp2p.peer.id import (
|
|||
from .pb import rpc_pb2
|
||||
from .pubsub import Pubsub
|
||||
from .pubsub_router_interface import IPubsubRouter
|
||||
from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
|
||||
|
||||
class FloodSub(IPubsubRouter):
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from ast import literal_eval
|
||||
import asyncio
|
||||
import random
|
||||
from typing import (
|
||||
|
@ -9,8 +10,6 @@ from typing import (
|
|||
Sequence,
|
||||
)
|
||||
|
||||
from ast import literal_eval
|
||||
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
id_b58_decode,
|
||||
|
|
|
@ -10,21 +10,14 @@ from typing import (
|
|||
|
||||
from lru import LRU
|
||||
|
||||
from libp2p.host.host_interface import IHost
|
||||
from libp2p.peer.id import ID
|
||||
|
||||
from libp2p.network.stream.net_stream_interface import INetStream
|
||||
|
||||
from .pb import rpc_pb2
|
||||
from .pubsub_notifee import PubsubNotifee
|
||||
from .pubsub_router_interface import (
|
||||
IPubsubRouter,
|
||||
)
|
||||
from libp2p.host.host_interface import (
|
||||
IHost,
|
||||
)
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
from .pubsub_router_interface import IPubsubRouter
|
||||
|
||||
|
||||
def get_msg_id(msg: rpc_pb2.Message) -> Tuple[bytes, bytes]:
|
||||
|
|
|
@ -5,21 +5,12 @@ from typing import (
|
|||
|
||||
from multiaddr import Multiaddr
|
||||
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.stream_muxer.muxed_connection_interface import (
|
||||
IMuxedConn,
|
||||
)
|
||||
from libp2p.network.notifee_interface import (
|
||||
INotifee,
|
||||
)
|
||||
from libp2p.network.network_interface import (
|
||||
INetwork,
|
||||
)
|
||||
from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.network.network_interface import INetwork
|
||||
from libp2p.network.notifee_interface import INotifee
|
||||
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||
|
||||
from libp2p.network.stream.net_stream_interface import INetStream
|
||||
|
||||
|
||||
class PubsubNotifee(INotifee):
|
||||
|
|
|
@ -3,11 +3,10 @@ from typing import (
|
|||
List,
|
||||
)
|
||||
|
||||
from libp2p.peer.id import ID
|
||||
|
||||
from .pb import rpc_pb2
|
||||
from .pubsub import Pubsub
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
|
||||
class IPubsubRouter(ABC):
|
||||
|
||||
|
|
|
@ -5,12 +5,8 @@ from typing import (
|
|||
Iterable,
|
||||
)
|
||||
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.peer.peerinfo import (
|
||||
PeerInfo,
|
||||
)
|
||||
from libp2p.peer.id import ID
|
||||
from libp2p.peer.peerinfo import PeerInfo
|
||||
# pylint: disable=too-few-public-methods
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user