py-libp2p/libp2p/typing.py

13 lines
415 B
Python
Raw Normal View History

import asyncio
from typing import TYPE_CHECKING, Awaitable, Callable, NewType, Union
2019-08-07 18:02:30 +08:00
if TYPE_CHECKING:
from libp2p.network.stream.net_stream_interface import INetStream # noqa: F401
from libp2p.stream_muxer.abc import IMuxedStream # noqa: F401
2019-08-07 18:02:30 +08:00
TProtocol = NewType("TProtocol", str)
StreamHandlerFn = Callable[["INetStream"], Awaitable[None]]
2019-08-08 15:58:30 +08:00
StreamReader = Union["IMuxedStream", asyncio.StreamReader]