Run isort
in repo
This commit is contained in:
parent
a92d933ed2
commit
c8005c8113
|
@ -8,7 +8,6 @@ import multiaddr
|
||||||
from libp2p import new_node
|
from libp2p import new_node
|
||||||
from libp2p.peer.peerinfo import info_from_p2p_addr
|
from libp2p.peer.peerinfo import info_from_p2p_addr
|
||||||
|
|
||||||
|
|
||||||
PROTOCOL_ID = "/chat/1.0.0"
|
PROTOCOL_ID = "/chat/1.0.0"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,15 @@ import asyncio
|
||||||
|
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
|
|
||||||
from .security.insecure_security import InsecureTransport
|
|
||||||
from .peer.peerstore import PeerStore
|
|
||||||
from .peer.id import ID
|
|
||||||
from .network.swarm import Swarm
|
|
||||||
from .host.basic_host import BasicHost
|
from .host.basic_host import BasicHost
|
||||||
from .transport.upgrader import TransportUpgrader
|
|
||||||
from .transport.tcp.tcp import TCP
|
|
||||||
from .kademlia.network import KademliaServer
|
from .kademlia.network import KademliaServer
|
||||||
|
from .network.swarm import Swarm
|
||||||
|
from .peer.id import ID
|
||||||
|
from .peer.peerstore import PeerStore
|
||||||
from .routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter
|
from .routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter
|
||||||
|
from .security.insecure_security import InsecureTransport
|
||||||
|
from .transport.tcp.tcp import TCP
|
||||||
|
from .transport.upgrader import TransportUpgrader
|
||||||
|
|
||||||
|
|
||||||
async def cleanup_done_tasks():
|
async def cleanup_done_tasks():
|
||||||
|
|
|
@ -3,11 +3,10 @@ from typing import Any, Awaitable, Callable, List, Sequence
|
||||||
import multiaddr
|
import multiaddr
|
||||||
|
|
||||||
from libp2p.network.network_interface import INetwork
|
from libp2p.network.network_interface import INetwork
|
||||||
|
from libp2p.network.stream.net_stream_interface import INetStream
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
from libp2p.peer.peerinfo import PeerInfo
|
from libp2p.peer.peerinfo import PeerInfo
|
||||||
from libp2p.peer.peerstore_interface import IPeerStore
|
from libp2p.peer.peerstore_interface import IPeerStore
|
||||||
|
|
||||||
from libp2p.network.stream.net_stream_interface import INetStream
|
|
||||||
from libp2p.routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter
|
from libp2p.routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter
|
||||||
|
|
||||||
from .host_interface import IHost
|
from .host_interface import IHost
|
||||||
|
|
|
@ -4,12 +4,10 @@ from typing import Any, Awaitable, Callable, List, Sequence
|
||||||
import multiaddr
|
import multiaddr
|
||||||
|
|
||||||
from libp2p.network.network_interface import INetwork
|
from libp2p.network.network_interface import INetwork
|
||||||
|
from libp2p.network.stream.net_stream_interface import INetStream
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
from libp2p.peer.peerinfo import PeerInfo
|
from libp2p.peer.peerinfo import PeerInfo
|
||||||
|
|
||||||
from libp2p.network.stream.net_stream_interface import INetStream
|
|
||||||
|
|
||||||
|
|
||||||
StreamHandlerFn = Callable[[INetStream], Awaitable[None]]
|
StreamHandlerFn = Callable[[INetStream], Awaitable[None]]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import logging
|
||||||
from .kad_peerinfo import KadPeerHeap, create_kad_peerinfo
|
from .kad_peerinfo import KadPeerHeap, create_kad_peerinfo
|
||||||
from .utils import gather_dict
|
from .utils import gather_dict
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
import heapq
|
import heapq
|
||||||
|
from operator import itemgetter
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from operator import itemgetter
|
|
||||||
from multiaddr import Multiaddr
|
from multiaddr import Multiaddr
|
||||||
from libp2p.peer.peerinfo import PeerInfo
|
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
from libp2p.peer.peerdata import PeerData
|
from libp2p.peer.peerdata import PeerData
|
||||||
|
from libp2p.peer.peerinfo import PeerInfo
|
||||||
|
|
||||||
from .utils import digest
|
from .utils import digest
|
||||||
|
|
||||||
P_IP = "ip4"
|
P_IP = "ip4"
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
"""
|
"""
|
||||||
Package for interacting on the network at a high level.
|
Package for interacting on the network at a high level.
|
||||||
"""
|
"""
|
||||||
import pickle
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
import pickle
|
||||||
|
|
||||||
from .protocol import KademliaProtocol
|
from .crawling import NodeSpiderCrawl, ValueSpiderCrawl
|
||||||
from .utils import digest
|
|
||||||
from .storage import ForgetfulStorage
|
|
||||||
from .kad_peerinfo import create_kad_peerinfo
|
from .kad_peerinfo import create_kad_peerinfo
|
||||||
from .crawling import ValueSpiderCrawl
|
from .protocol import KademliaProtocol
|
||||||
from .crawling import NodeSpiderCrawl
|
from .storage import ForgetfulStorage
|
||||||
|
from .utils import digest
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import random
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
import random
|
||||||
|
|
||||||
from rpcudp.protocol import RPCProtocol
|
from rpcudp.protocol import RPCProtocol
|
||||||
|
|
||||||
from .kad_peerinfo import create_kad_peerinfo
|
from .kad_peerinfo import create_kad_peerinfo
|
||||||
from .routing import RoutingTable
|
from .routing import RoutingTable
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import heapq
|
|
||||||
import time
|
|
||||||
import operator
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from .utils import OrderedSet, shared_prefix, bytes_to_bit_string
|
import heapq
|
||||||
|
import operator
|
||||||
|
import time
|
||||||
|
|
||||||
|
from .utils import OrderedSet, bytes_to_bit_string, shared_prefix
|
||||||
|
|
||||||
|
|
||||||
class KBucket:
|
class KBucket:
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import time
|
from abc import ABC, abstractmethod
|
||||||
|
from collections import OrderedDict
|
||||||
from itertools import takewhile
|
from itertools import takewhile
|
||||||
import operator
|
import operator
|
||||||
from collections import OrderedDict
|
import time
|
||||||
from abc import abstractmethod, ABC
|
|
||||||
|
|
||||||
|
|
||||||
class IStorage(ABC):
|
class IStorage(ABC):
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
"""
|
"""
|
||||||
General catchall for functions that don't make sense as methods.
|
General catchall for functions that don't make sense as methods.
|
||||||
"""
|
"""
|
||||||
|
import asyncio
|
||||||
import hashlib
|
import hashlib
|
||||||
import operator
|
import operator
|
||||||
import asyncio
|
|
||||||
|
|
||||||
|
|
||||||
async def gather_dict(dic):
|
async def gather_dict(dic):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import Awaitable, Callable, Dict, Sequence, TYPE_CHECKING
|
from typing import TYPE_CHECKING, Awaitable, Callable, Dict, Sequence
|
||||||
|
|
||||||
from multiaddr import Multiaddr
|
from multiaddr import Multiaddr
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,8 @@ from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from multiaddr import Multiaddr
|
from multiaddr import Multiaddr
|
||||||
|
|
||||||
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
|
||||||
|
|
||||||
from libp2p.network.stream.net_stream_interface import INetStream
|
from libp2p.network.stream.net_stream_interface import INetStream
|
||||||
|
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from .network_interface import INetwork
|
from .network_interface import INetwork
|
||||||
|
|
|
@ -10,18 +10,16 @@ from libp2p.protocol_muxer.multiselect_client import MultiselectClient
|
||||||
from libp2p.routing.interfaces import IPeerRouting
|
from libp2p.routing.interfaces import IPeerRouting
|
||||||
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||||
from libp2p.stream_muxer.muxed_stream_interface import IMuxedStream
|
from libp2p.stream_muxer.muxed_stream_interface import IMuxedStream
|
||||||
from libp2p.transport.upgrader import TransportUpgrader
|
|
||||||
from libp2p.transport.transport_interface import ITransport
|
|
||||||
from libp2p.transport.listener_interface import IListener
|
from libp2p.transport.listener_interface import IListener
|
||||||
|
from libp2p.transport.transport_interface import ITransport
|
||||||
|
from libp2p.transport.upgrader import TransportUpgrader
|
||||||
|
|
||||||
|
from .connection.raw_connection import RawConnection
|
||||||
from .network_interface import INetwork
|
from .network_interface import INetwork
|
||||||
from .notifee_interface import INotifee
|
from .notifee_interface import INotifee
|
||||||
from .connection.raw_connection import RawConnection
|
|
||||||
from .stream.net_stream import NetStream
|
from .stream.net_stream import NetStream
|
||||||
from .stream.net_stream_interface import INetStream
|
from .stream.net_stream_interface import INetStream
|
||||||
|
|
||||||
|
|
||||||
StreamHandlerFn = Callable[[INetStream], Awaitable[None]]
|
StreamHandlerFn = Callable[[INetStream], Awaitable[None]]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import List, Sequence
|
from typing import List, Sequence
|
||||||
|
|
||||||
|
|
||||||
from multiaddr import Multiaddr
|
from multiaddr import Multiaddr
|
||||||
|
|
||||||
from .id import ID
|
from .id import ID
|
||||||
|
|
|
@ -2,7 +2,6 @@ import hashlib
|
||||||
from typing import Union
|
from typing import Union
|
||||||
|
|
||||||
import base58
|
import base58
|
||||||
|
|
||||||
import multihash
|
import multihash
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from typing import List, Sequence
|
from typing import List, Sequence
|
||||||
|
|
||||||
|
|
||||||
from .addrbook_interface import IAddrBook
|
from .addrbook_interface import IAddrBook
|
||||||
from .id import ID
|
from .id import ID
|
||||||
from .peerinfo import PeerInfo
|
from .peerinfo import PeerInfo
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from .multiselect_muxer_interface import IMultiselectMuxer
|
|
||||||
from .multiselect_communicator import MultiselectCommunicator
|
from .multiselect_communicator import MultiselectCommunicator
|
||||||
|
from .multiselect_muxer_interface import IMultiselectMuxer
|
||||||
|
|
||||||
MULTISELECT_PROTOCOL_ID = "/multistream/1.0.0"
|
MULTISELECT_PROTOCOL_ID = "/multistream/1.0.0"
|
||||||
PROTOCOL_NOT_FOUND_MSG = "na"
|
PROTOCOL_NOT_FOUND_MSG = "na"
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from .multiselect_client_interface import IMultiselectClient
|
from .multiselect_client_interface import IMultiselectClient
|
||||||
from .multiselect_communicator import MultiselectCommunicator
|
from .multiselect_communicator import MultiselectCommunicator
|
||||||
|
|
||||||
|
|
||||||
MULTISELECT_PROTOCOL_ID = "/multistream/1.0.0"
|
MULTISELECT_PROTOCOL_ID = "/multistream/1.0.0"
|
||||||
PROTOCOL_NOT_FOUND_MSG = "na"
|
PROTOCOL_NOT_FOUND_MSG = "na"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from ast import literal_eval
|
from ast import literal_eval
|
||||||
import asyncio
|
import asyncio
|
||||||
import random
|
import random
|
||||||
from typing import Any, Dict, Iterable, List, Set, Sequence
|
from typing import Any, Dict, Iterable, List, Sequence, Set
|
||||||
|
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import time
|
import time
|
||||||
from typing import Any, Dict, List, Tuple, TYPE_CHECKING
|
from typing import TYPE_CHECKING, Any, Dict, List, Tuple
|
||||||
|
|
||||||
from lru import LRU
|
from lru import LRU
|
||||||
|
|
||||||
from libp2p.host.host_interface import IHost
|
from libp2p.host.host_interface import IHost
|
||||||
from libp2p.peer.id import ID
|
|
||||||
|
|
||||||
from libp2p.network.stream.net_stream_interface import INetStream
|
from libp2p.network.stream.net_stream_interface import INetStream
|
||||||
|
from libp2p.peer.id import ID
|
||||||
|
|
||||||
from .pb import rpc_pb2
|
from .pb import rpc_pb2
|
||||||
from .pubsub_notifee import PubsubNotifee
|
from .pubsub_notifee import PubsubNotifee
|
||||||
|
|
|
@ -4,9 +4,8 @@ from multiaddr import Multiaddr
|
||||||
|
|
||||||
from libp2p.network.network_interface import INetwork
|
from libp2p.network.network_interface import INetwork
|
||||||
from libp2p.network.notifee_interface import INotifee
|
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
|
from libp2p.network.stream.net_stream_interface import INetStream
|
||||||
|
from libp2p.stream_muxer.muxed_connection_interface import IMuxedConn
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from typing import List, TYPE_CHECKING
|
from typing import TYPE_CHECKING, List
|
||||||
|
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from libp2p.security.secure_transport_interface import ISecureTransport
|
from typing import TYPE_CHECKING, Any, Dict, cast
|
||||||
from libp2p.security.secure_conn_interface import ISecureConn
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Dict, Any, cast
|
from libp2p.security.secure_conn_interface import ISecureConn
|
||||||
|
from libp2p.security.secure_transport_interface import ISecureTransport
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from libp2p.protocol_muxer.multiselect_client import MultiselectClient
|
from typing import TYPE_CHECKING, Dict, NewType
|
||||||
from libp2p.protocol_muxer.multiselect import Multiselect
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, NewType, Dict
|
from libp2p.protocol_muxer.multiselect import Multiselect
|
||||||
|
from libp2p.protocol_muxer.multiselect_client import MultiselectClient
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
from libp2p.security.secure_transport_interface import ISecureTransport
|
|
||||||
from libp2p.security.secure_conn_interface import ISecureConn
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, cast
|
from typing import TYPE_CHECKING, cast
|
||||||
|
|
||||||
|
from libp2p.security.secure_conn_interface import ISecureConn
|
||||||
|
from libp2p.security.secure_transport_interface import ISecureTransport
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from typing import TypeVar, Dict, Any, NewType
|
from typing import Any, Dict, NewType, TypeVar
|
||||||
|
|
||||||
|
|
||||||
TSecurityDetails = NewType("TSecurityDetails", Dict[str, str])
|
TSecurityDetails = NewType("TSecurityDetails", Dict[str, str])
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from .utils import encode_uvarint, decode_uvarint_from_stream, get_flag
|
|
||||||
from .mplex_stream import MplexStream
|
|
||||||
from ..muxed_connection_interface import IMuxedConn
|
from ..muxed_connection_interface import IMuxedConn
|
||||||
|
from .mplex_stream import MplexStream
|
||||||
|
from .utils import decode_uvarint_from_stream, encode_uvarint, get_flag
|
||||||
|
|
||||||
|
|
||||||
class Mplex(IMuxedConn):
|
class Mplex(IMuxedConn):
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from .constants import HEADER_TAGS
|
from .constants import HEADER_TAGS
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from libp2p.stream_muxer.mplex.mplex import Mplex
|
|
||||||
from libp2p.security.security_multistream import SecurityMultistream
|
from libp2p.security.security_multistream import SecurityMultistream
|
||||||
|
from libp2p.stream_muxer.mplex.mplex import Mplex
|
||||||
|
|
||||||
|
|
||||||
class TransportUpgrader:
|
class TransportUpgrader:
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -1,6 +1,5 @@
|
||||||
import setuptools
|
import setuptools
|
||||||
|
|
||||||
|
|
||||||
classifiers = [f"Programming Language :: Python :: {version}" for version in ["3.7"]]
|
classifiers = [f"Programming Language :: Python :: {version}" for version in ["3.7"]]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import pytest
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import multiaddr
|
|
||||||
|
|
||||||
from tests.utils import cleanup, set_up_nodes_by_transport_opt
|
import multiaddr
|
||||||
|
import pytest
|
||||||
|
|
||||||
from libp2p import new_node
|
from libp2p import new_node
|
||||||
from libp2p.peer.peerinfo import info_from_p2p_addr
|
from libp2p.peer.peerinfo import info_from_p2p_addr
|
||||||
from libp2p.protocol_muxer.multiselect_client import MultiselectClientError
|
from libp2p.protocol_muxer.multiselect_client import MultiselectClientError
|
||||||
|
from tests.utils import cleanup, set_up_nodes_by_transport_opt
|
||||||
|
|
||||||
PROTOCOL_ID = "/chat/1.0.0"
|
PROTOCOL_ID = "/chat/1.0.0"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from libp2p.kademlia.network import KademliaServer
|
from libp2p.kademlia.network import KademliaServer
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from libp2p.kademlia.network import KademliaServer
|
from libp2p.kademlia.network import KademliaServer
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import multiaddr
|
import multiaddr
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from tests.utils import cleanup, set_up_nodes_by_transport_opt
|
|
||||||
from libp2p.peer.peerinfo import info_from_p2p_addr
|
from libp2p.peer.peerinfo import info_from_p2p_addr
|
||||||
|
from tests.utils import cleanup, set_up_nodes_by_transport_opt
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
|
|
@ -9,17 +9,17 @@ TODO: Add tests for closed_stream disconnected, listen_close when those
|
||||||
features are implemented in swarm
|
features are implemented in swarm
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import pytest
|
|
||||||
import multiaddr
|
import multiaddr
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from libp2p import initialize_default_swarm, new_node
|
||||||
|
from libp2p.host.basic_host import BasicHost
|
||||||
|
from libp2p.network.notifee_interface import INotifee
|
||||||
from tests.utils import (
|
from tests.utils import (
|
||||||
cleanup,
|
cleanup,
|
||||||
echo_stream_handler,
|
echo_stream_handler,
|
||||||
perform_two_host_set_up_custom_handler,
|
perform_two_host_set_up_custom_handler,
|
||||||
)
|
)
|
||||||
from libp2p import new_node, initialize_default_swarm
|
|
||||||
from libp2p.network.notifee_interface import INotifee
|
|
||||||
from libp2p.host.basic_host import BasicHost
|
|
||||||
|
|
||||||
|
|
||||||
class MyNotifee(INotifee):
|
class MyNotifee(INotifee):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from libp2p.peer.peerstore import PeerStoreError
|
from libp2p.peer.peerstore import PeerStore, PeerStoreError
|
||||||
from libp2p.peer.peerstore import PeerStore
|
|
||||||
|
|
||||||
# Testing methods from IAddrBook base class.
|
# Testing methods from IAddrBook base class.
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
from Crypto.PublicKey import RSA
|
||||||
|
import base58
|
||||||
import multihash
|
import multihash
|
||||||
import pytest
|
import pytest
|
||||||
import base58
|
|
||||||
from Crypto.PublicKey import RSA
|
|
||||||
from libp2p.peer.id import ID
|
|
||||||
|
|
||||||
|
from libp2p.peer.id import ID
|
||||||
|
|
||||||
ALPHABETS = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
ALPHABETS = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
import multiaddr
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import multiaddr
|
|
||||||
|
|
||||||
from libp2p.peer.peerinfo import PeerInfo, info_from_p2p_addr, InvalidAddrError
|
|
||||||
from libp2p.peer.peerdata import PeerData
|
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
|
from libp2p.peer.peerdata import PeerData
|
||||||
|
from libp2p.peer.peerinfo import InvalidAddrError, PeerInfo, info_from_p2p_addr
|
||||||
|
|
||||||
ALPHABETS = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
ALPHABETS = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from libp2p.peer.peerstore import PeerStore, PeerStoreError
|
||||||
from libp2p.peer.peerstore import PeerStoreError
|
|
||||||
from libp2p.peer.peerstore import PeerStore
|
|
||||||
|
|
||||||
# Testing methods from IPeerMetadata base class.
|
# Testing methods from IPeerMetadata base class.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from tests.utils import cleanup, set_up_nodes_by_transport_opt
|
|
||||||
from libp2p.protocol_muxer.multiselect_client import MultiselectClientError
|
from libp2p.protocol_muxer.multiselect_client import MultiselectClientError
|
||||||
|
from tests.utils import cleanup, set_up_nodes_by_transport_opt
|
||||||
|
|
||||||
# TODO: Add tests for multiple streams being opened on different
|
# TODO: Add tests for multiple streams being opened on different
|
||||||
# protocols through the same connection
|
# protocols through the same connection
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
|
|
||||||
|
|
||||||
FLOODSUB_PROTOCOL_ID = "/floodsub/1.0.0"
|
FLOODSUB_PROTOCOL_ID = "/floodsub/1.0.0"
|
||||||
GOSSIPSUB_PROTOCOL_ID = "/gossipsub/1.0.0"
|
GOSSIPSUB_PROTOCOL_ID = "/gossipsub/1.0.0"
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,11 @@ import uuid
|
||||||
from libp2p.host.host_interface import IHost
|
from libp2p.host.host_interface import IHost
|
||||||
from libp2p.pubsub.floodsub import FloodSub
|
from libp2p.pubsub.floodsub import FloodSub
|
||||||
from libp2p.pubsub.pubsub import Pubsub
|
from libp2p.pubsub.pubsub import Pubsub
|
||||||
|
|
||||||
from tests.configs import LISTEN_MADDR
|
from tests.configs import LISTEN_MADDR
|
||||||
|
|
||||||
from .factories import FloodsubFactory, PubsubFactory
|
from .factories import FloodsubFactory, PubsubFactory
|
||||||
from .utils import message_id_generator
|
from .utils import message_id_generator
|
||||||
|
|
||||||
|
|
||||||
CRYPTO_TOPIC = "ethereum"
|
CRYPTO_TOPIC = "ethereum"
|
||||||
|
|
||||||
# Message format:
|
# Message format:
|
||||||
|
|
|
@ -7,10 +7,9 @@ from libp2p.host.basic_host import BasicHost
|
||||||
from libp2p.pubsub.floodsub import FloodSub
|
from libp2p.pubsub.floodsub import FloodSub
|
||||||
from libp2p.pubsub.gossipsub import GossipSub
|
from libp2p.pubsub.gossipsub import GossipSub
|
||||||
from libp2p.pubsub.pubsub import Pubsub
|
from libp2p.pubsub.pubsub import Pubsub
|
||||||
|
|
||||||
from tests.configs import LISTEN_MADDR
|
from tests.configs import LISTEN_MADDR
|
||||||
|
|
||||||
from .configs import FLOODSUB_PROTOCOL_ID, GOSSIPSUB_PROTOCOL_ID, GOSSIPSUB_PARAMS
|
from .configs import FLOODSUB_PROTOCOL_ID, GOSSIPSUB_PARAMS, GOSSIPSUB_PROTOCOL_ID
|
||||||
|
|
||||||
|
|
||||||
def swarm_factory():
|
def swarm_factory():
|
||||||
|
|
|
@ -8,7 +8,6 @@ from tests.utils import cleanup, connect
|
||||||
from .configs import FLOODSUB_PROTOCOL_ID
|
from .configs import FLOODSUB_PROTOCOL_ID
|
||||||
from .factories import PubsubFactory
|
from .factories import PubsubFactory
|
||||||
|
|
||||||
|
|
||||||
SUPPORTED_PROTOCOLS = [FLOODSUB_PROTOCOL_ID]
|
SUPPORTED_PROTOCOLS = [FLOODSUB_PROTOCOL_ID]
|
||||||
|
|
||||||
FLOODSUB_PROTOCOL_TEST_CASES = [
|
FLOODSUB_PROTOCOL_TEST_CASES = [
|
||||||
|
|
|
@ -3,13 +3,12 @@ import asyncio
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
|
|
||||||
from tests.utils import cleanup, connect
|
from tests.utils import cleanup, connect
|
||||||
|
|
||||||
from .factories import FloodsubFactory
|
from .factories import FloodsubFactory
|
||||||
from .floodsub_integration_test_settings import (
|
from .floodsub_integration_test_settings import (
|
||||||
perform_test_from_obj,
|
|
||||||
floodsub_protocol_pytest_params,
|
floodsub_protocol_pytest_params,
|
||||||
|
perform_test_from_obj,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ import pytest
|
||||||
from .configs import FLOODSUB_PROTOCOL_ID
|
from .configs import FLOODSUB_PROTOCOL_ID
|
||||||
from .factories import GossipsubFactory
|
from .factories import GossipsubFactory
|
||||||
from .floodsub_integration_test_settings import (
|
from .floodsub_integration_test_settings import (
|
||||||
perform_test_from_obj,
|
|
||||||
floodsub_protocol_pytest_params,
|
floodsub_protocol_pytest_params,
|
||||||
|
perform_test_from_obj,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,10 @@ import pytest
|
||||||
|
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
from libp2p.pubsub.pb import rpc_pb2
|
from libp2p.pubsub.pb import rpc_pb2
|
||||||
|
|
||||||
from tests.utils import connect
|
from tests.utils import connect
|
||||||
|
|
||||||
from .utils import make_pubsub_msg
|
from .utils import make_pubsub_msg
|
||||||
|
|
||||||
|
|
||||||
TESTING_TOPIC = "TEST_SUBSCRIBE"
|
TESTING_TOPIC = "TEST_SUBSCRIBE"
|
||||||
TESTING_DATA = b"data"
|
TESTING_DATA = b"data"
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ from typing import Sequence
|
||||||
|
|
||||||
from libp2p.peer.id import ID
|
from libp2p.peer.id import ID
|
||||||
from libp2p.pubsub.pb import rpc_pb2
|
from libp2p.pubsub.pb import rpc_pb2
|
||||||
|
|
||||||
from tests.utils import connect
|
from tests.utils import connect
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from libp2p.peer.id import ID
|
|
||||||
from libp2p.kademlia.network import KademliaServer
|
from libp2p.kademlia.network import KademliaServer
|
||||||
|
from libp2p.peer.id import ID
|
||||||
from libp2p.routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter
|
from libp2p.routing.kademlia.kademlia_peer_router import KadmeliaPeerRouter
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
import multiaddr
|
import multiaddr
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
@ -7,10 +8,8 @@ from libp2p.peer.peerinfo import info_from_p2p_addr
|
||||||
from libp2p.protocol_muxer.multiselect_client import MultiselectClientError
|
from libp2p.protocol_muxer.multiselect_client import MultiselectClientError
|
||||||
from libp2p.security.insecure_security import InsecureTransport
|
from libp2p.security.insecure_security import InsecureTransport
|
||||||
from libp2p.security.simple_security import SimpleSecurityTransport
|
from libp2p.security.simple_security import SimpleSecurityTransport
|
||||||
|
|
||||||
from tests.utils import cleanup, connect
|
from tests.utils import cleanup, connect
|
||||||
|
|
||||||
|
|
||||||
# TODO: Add tests for multiple streams being opened on different
|
# TODO: Add tests for multiple streams being opened on different
|
||||||
# protocols through the same connection
|
# protocols through the same connection
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from contextlib import suppress
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from contextlib import suppress
|
||||||
|
|
||||||
import multiaddr
|
import multiaddr
|
||||||
|
|
||||||
from libp2p import new_node
|
from libp2p import new_node
|
||||||
|
|
Loading…
Reference in New Issue
Block a user