mypy: Add read_buffer_nonblocking in Mplex

This commit is contained in:
mhchia 2019-08-12 14:40:31 +08:00 committed by Kevin Mai-Husan Chia
parent f281e3e1db
commit e37b8bcf19
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,4 @@
import coincurve import coincurve
from libp2p.crypto.keys import KeyPair, KeyType, PrivateKey, PublicKey from libp2p.crypto.keys import KeyPair, KeyType, PrivateKey, PublicKey

View File

@ -1,5 +1,5 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from typing import TYPE_CHECKING from typing import TYPE_CHECKING, Optional
from multiaddr import Multiaddr from multiaddr import Multiaddr
@ -56,6 +56,12 @@ class IMuxedConn(ABC):
:return: message read :return: message read
""" """
@abstractmethod
async def read_buffer_nonblocking(self, stream_id: int) -> Optional[bytes]:
"""
Read a message from `stream_id`'s buffer, non-blockingly.
"""
@abstractmethod @abstractmethod
async def open_stream( async def open_stream(
self, protocol_id: str, multi_addr: Multiaddr self, protocol_id: str, multi_addr: Multiaddr