mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
rename typing.py to custom_types.py for clarity
This commit is contained in:
@ -32,10 +32,10 @@ libp2p.exceptions module
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
libp2p.typing module
|
||||
--------------------
|
||||
libp2p.custom_types module
|
||||
--------------------------
|
||||
|
||||
.. automodule:: libp2p.typing
|
||||
.. automodule:: libp2p.custom_types
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
@ -7,15 +7,15 @@ import trio
|
||||
from libp2p import (
|
||||
new_host,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
from libp2p.peer.peerinfo import (
|
||||
info_from_p2p_addr,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
PROTOCOL_ID = TProtocol("/chat/1.0.0")
|
||||
MAX_READ_LEN = 2**32 - 1
|
||||
|
||||
@ -9,15 +9,15 @@ from libp2p import (
|
||||
from libp2p.crypto.secp256k1 import (
|
||||
create_new_key_pair,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
from libp2p.peer.peerinfo import (
|
||||
info_from_p2p_addr,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
PROTOCOL_ID = TProtocol("/echo/1.0.0")
|
||||
|
||||
|
||||
@ -6,15 +6,15 @@ import trio
|
||||
from libp2p import (
|
||||
new_host,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
from libp2p.peer.peerinfo import (
|
||||
info_from_p2p_addr,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
PING_PROTOCOL_ID = TProtocol("/ipfs/ping/1.0.0")
|
||||
PING_LENGTH = 32
|
||||
|
||||
@ -6,6 +6,9 @@ from libp2p.crypto.keys import (
|
||||
from libp2p.crypto.rsa import (
|
||||
create_new_key_pair,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.host.basic_host import (
|
||||
BasicHost,
|
||||
)
|
||||
@ -52,9 +55,6 @@ from libp2p.transport.typing import (
|
||||
from libp2p.transport.upgrader import (
|
||||
TransportUpgrader,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
|
||||
def generate_new_rsa_identity() -> KeyPair:
|
||||
|
||||
@ -16,6 +16,10 @@ from libp2p.crypto.keys import (
|
||||
PrivateKey,
|
||||
PublicKey,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
StreamHandlerFn,
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.host.defaults import (
|
||||
get_default_protocols,
|
||||
)
|
||||
@ -53,10 +57,6 @@ from libp2p.protocol_muxer.multiselect_communicator import (
|
||||
from libp2p.tools.async_service import (
|
||||
background_trio_service,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
StreamHandlerFn,
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .host_interface import (
|
||||
IHost,
|
||||
|
||||
@ -18,7 +18,7 @@ from libp2p.identity.identify.protocol import (
|
||||
from libp2p.identity.identify.protocol import ID as IdentifyID
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from libp2p.typing import (
|
||||
from libp2p.custom_types import (
|
||||
StreamHandlerFn,
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
@ -16,6 +16,10 @@ from libp2p.crypto.keys import (
|
||||
PrivateKey,
|
||||
PublicKey,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
StreamHandlerFn,
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.network_interface import (
|
||||
INetworkService,
|
||||
)
|
||||
@ -28,10 +32,6 @@ from libp2p.peer.id import (
|
||||
from libp2p.peer.peerinfo import (
|
||||
PeerInfo,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
StreamHandlerFn,
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
|
||||
class IHost(ABC):
|
||||
|
||||
@ -4,6 +4,9 @@ import time
|
||||
|
||||
import trio
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.host.host_interface import (
|
||||
IHost,
|
||||
)
|
||||
@ -16,9 +19,6 @@ from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
from libp2p.peer.id import ID as PeerID
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
ID = TProtocol("/ipfs/ping/1.0.0")
|
||||
PING_LENGTH = 32
|
||||
|
||||
@ -4,6 +4,10 @@ from multiaddr import (
|
||||
Multiaddr,
|
||||
)
|
||||
|
||||
from libp2p.custom_types import (
|
||||
StreamHandlerFn,
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.host.host_interface import (
|
||||
IHost,
|
||||
)
|
||||
@ -13,10 +17,6 @@ from libp2p.network.stream.exceptions import (
|
||||
from libp2p.network.stream.net_stream_interface import (
|
||||
INetStream,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
StreamHandlerFn,
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .pb.identify_pb2 import (
|
||||
Identify,
|
||||
|
||||
@ -13,6 +13,9 @@ from multiaddr import (
|
||||
Multiaddr,
|
||||
)
|
||||
|
||||
from libp2p.custom_types import (
|
||||
StreamHandlerFn,
|
||||
)
|
||||
from libp2p.network.connection.net_connection_interface import (
|
||||
INetConn,
|
||||
)
|
||||
@ -28,9 +31,6 @@ from libp2p.tools.async_service import (
|
||||
from libp2p.transport.listener_interface import (
|
||||
IListener,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
StreamHandlerFn,
|
||||
)
|
||||
|
||||
from .stream.net_stream_interface import (
|
||||
INetStream,
|
||||
|
||||
@ -2,6 +2,9 @@ from typing import (
|
||||
Optional,
|
||||
)
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.stream_muxer.abc import (
|
||||
IMuxedStream,
|
||||
)
|
||||
@ -10,9 +13,6 @@ from libp2p.stream_muxer.exceptions import (
|
||||
MuxedStreamEOF,
|
||||
MuxedStreamReset,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .exceptions import (
|
||||
StreamClosed,
|
||||
|
||||
@ -2,15 +2,15 @@ from abc import (
|
||||
abstractmethod,
|
||||
)
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.io.abc import (
|
||||
ReadWriteCloser,
|
||||
)
|
||||
from libp2p.stream_muxer.abc import (
|
||||
IMuxedConn,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
|
||||
class INetStream(ReadWriteCloser):
|
||||
|
||||
@ -8,6 +8,9 @@ from multiaddr import (
|
||||
)
|
||||
import trio
|
||||
|
||||
from libp2p.custom_types import (
|
||||
StreamHandlerFn,
|
||||
)
|
||||
from libp2p.io.abc import (
|
||||
ReadWriteCloser,
|
||||
)
|
||||
@ -43,9 +46,6 @@ from libp2p.transport.transport_interface import (
|
||||
from libp2p.transport.upgrader import (
|
||||
TransportUpgrader,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
StreamHandlerFn,
|
||||
)
|
||||
|
||||
from ..exceptions import (
|
||||
MultiError,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from libp2p.typing import (
|
||||
from libp2p.custom_types import (
|
||||
StreamHandlerFn,
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
@ -2,7 +2,7 @@ from collections.abc import (
|
||||
Sequence,
|
||||
)
|
||||
|
||||
from libp2p.typing import (
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
|
||||
@ -6,12 +6,12 @@ from collections.abc import (
|
||||
Sequence,
|
||||
)
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.protocol_muxer.multiselect_communicator_interface import (
|
||||
IMultiselectCommunicator,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
|
||||
class IMultiselectClient(ABC):
|
||||
|
||||
@ -3,7 +3,7 @@ from abc import (
|
||||
abstractmethod,
|
||||
)
|
||||
|
||||
from libp2p.typing import (
|
||||
from libp2p.custom_types import (
|
||||
StreamHandlerFn,
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
@ -11,15 +11,15 @@ from typing import (
|
||||
AsyncContextManager,
|
||||
)
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.tools.async_service import (
|
||||
ServiceAPI,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .pb import (
|
||||
rpc_pb2,
|
||||
|
||||
@ -6,15 +6,15 @@ import logging
|
||||
|
||||
import trio
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.stream.exceptions import (
|
||||
StreamClosed,
|
||||
)
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.utils import (
|
||||
encode_varint_prefixed,
|
||||
)
|
||||
|
||||
@ -17,6 +17,9 @@ from typing import (
|
||||
|
||||
import trio
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.stream.exceptions import (
|
||||
StreamClosed,
|
||||
)
|
||||
@ -29,9 +32,6 @@ from libp2p.pubsub import (
|
||||
from libp2p.tools.async_service import (
|
||||
Service,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.utils import (
|
||||
encode_varint_prefixed,
|
||||
)
|
||||
|
||||
@ -26,6 +26,9 @@ import trio
|
||||
from libp2p.crypto.keys import (
|
||||
PrivateKey,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.exceptions import (
|
||||
ParseError,
|
||||
ValidationError,
|
||||
@ -53,9 +56,6 @@ from libp2p.peer.id import (
|
||||
from libp2p.tools.async_service import (
|
||||
Service,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.utils import (
|
||||
encode_varint_prefixed,
|
||||
read_varint_prefixed_bytes,
|
||||
|
||||
@ -11,6 +11,9 @@ from libp2p.crypto.pb import (
|
||||
from libp2p.crypto.serialization import (
|
||||
deserialize_public_key,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.io.abc import (
|
||||
ReadWriteCloser,
|
||||
)
|
||||
@ -38,9 +41,6 @@ from libp2p.security.exceptions import (
|
||||
from libp2p.security.secure_conn_interface import (
|
||||
ISecureConn,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .pb import (
|
||||
plaintext_pb2,
|
||||
|
||||
@ -2,6 +2,9 @@ from libp2p.crypto.keys import (
|
||||
KeyPair,
|
||||
PrivateKey,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.connection.raw_connection_interface import (
|
||||
IRawConnection,
|
||||
)
|
||||
@ -14,9 +17,6 @@ from libp2p.security.secure_conn_interface import (
|
||||
from libp2p.security.secure_transport_interface import (
|
||||
ISecureTransport,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .patterns import (
|
||||
IPattern,
|
||||
|
||||
@ -34,6 +34,9 @@ from libp2p.crypto.keys import (
|
||||
from libp2p.crypto.serialization import (
|
||||
deserialize_public_key,
|
||||
)
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.io.abc import (
|
||||
EncryptedMsgReadWriter,
|
||||
)
|
||||
@ -57,9 +60,6 @@ from libp2p.security.secure_conn_interface import (
|
||||
from libp2p.security.secure_session import (
|
||||
SecureSession,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .exceptions import (
|
||||
IncompatibleChoices,
|
||||
|
||||
@ -5,6 +5,9 @@ from collections import (
|
||||
OrderedDict,
|
||||
)
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.connection.raw_connection_interface import (
|
||||
IRawConnection,
|
||||
)
|
||||
@ -29,9 +32,6 @@ from libp2p.security.secure_transport_interface import (
|
||||
from libp2p.transport.typing import (
|
||||
TSecurityOptions,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
"""
|
||||
Represents a secured connection object, which includes a connection and details about
|
||||
|
||||
@ -5,6 +5,9 @@ from typing import (
|
||||
|
||||
import trio
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.exceptions import (
|
||||
ParseError,
|
||||
)
|
||||
@ -24,9 +27,6 @@ from libp2p.stream_muxer.abc import (
|
||||
IMuxedConn,
|
||||
IMuxedStream,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.utils import (
|
||||
decode_uvarint_from_stream,
|
||||
encode_uvarint,
|
||||
|
||||
@ -2,6 +2,9 @@ from collections import (
|
||||
OrderedDict,
|
||||
)
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.connection.raw_connection_interface import (
|
||||
IRawConnection,
|
||||
)
|
||||
@ -24,9 +27,6 @@ from libp2p.transport.typing import (
|
||||
TMuxerClass,
|
||||
TMuxerOptions,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .abc import (
|
||||
IMuxedConn,
|
||||
|
||||
@ -28,6 +28,9 @@ from libp2p.crypto.keys import (
|
||||
PrivateKey,
|
||||
)
|
||||
from libp2p.crypto.secp256k1 import create_new_key_pair as create_secp256k1_key_pair
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.host.basic_host import (
|
||||
BasicHost,
|
||||
)
|
||||
@ -121,9 +124,6 @@ from libp2p.transport.typing import (
|
||||
from libp2p.transport.upgrader import (
|
||||
TransportUpgrader,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .constants import (
|
||||
FLOODSUB_PROTOCOL_ID,
|
||||
|
||||
@ -6,6 +6,9 @@ from typing import (
|
||||
Callable,
|
||||
)
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.io.abc import (
|
||||
ReadWriteCloser,
|
||||
)
|
||||
@ -15,9 +18,6 @@ from libp2p.security.secure_transport_interface import (
|
||||
from libp2p.stream_muxer.abc import (
|
||||
IMuxedConn,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
THandler = Callable[[ReadWriteCloser], Awaitable[None]]
|
||||
TSecurityOptions = Mapping[TProtocol, ISecureTransport]
|
||||
|
||||
1
newsfragments/500.internal.rst
Normal file
1
newsfragments/500.internal.rst
Normal file
@ -0,0 +1 @@
|
||||
Rename ``typing.py`` to ``custom_types.py`` for clarity.
|
||||
@ -1,6 +1,9 @@
|
||||
import pytest
|
||||
import multiaddr
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.network.stream.exceptions import (
|
||||
StreamError,
|
||||
)
|
||||
@ -14,9 +17,6 @@ from libp2p.tools.utils import (
|
||||
connect,
|
||||
create_echo_stream_handler,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
PROTOCOL_ID_0 = TProtocol("/echo/0")
|
||||
PROTOCOL_ID_1 = TProtocol("/echo/1")
|
||||
|
||||
@ -9,6 +9,9 @@ from p2pclient.utils import (
|
||||
)
|
||||
import trio
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.peer.peerinfo import (
|
||||
PeerInfo,
|
||||
info_from_p2p_addr,
|
||||
@ -16,9 +19,6 @@ from libp2p.peer.peerinfo import (
|
||||
from libp2p.tools.factories import (
|
||||
HostFactory,
|
||||
)
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
from tests.utils.interop.envs import (
|
||||
GO_BIN_PATH,
|
||||
)
|
||||
|
||||
@ -14,6 +14,9 @@ from p2pclient import (
|
||||
)
|
||||
import trio
|
||||
|
||||
from libp2p.custom_types import (
|
||||
TProtocol,
|
||||
)
|
||||
from libp2p.peer.id import (
|
||||
ID,
|
||||
)
|
||||
@ -23,9 +26,6 @@ from libp2p.peer.peerinfo import (
|
||||
)
|
||||
from libp2p.security.noise.transport import PROTOCOL_ID as NOISE_PROTOCOL_ID
|
||||
from libp2p.security.secio.transport import ID as SECIO_PROTOCOL_ID
|
||||
from libp2p.typing import (
|
||||
TProtocol,
|
||||
)
|
||||
|
||||
from .constants import (
|
||||
LOCALHOST_IP,
|
||||
|
||||
Reference in New Issue
Block a user