mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-11 23:51:07 +00:00
Enforce pre-summary newline in docstrings
This commit is contained in:
@ -41,7 +41,8 @@ class Mplex(IMuxedConn):
|
||||
_tasks: List["asyncio.Future[Any]"]
|
||||
|
||||
def __init__(self, secured_conn: ISecureConn, peer_id: ID) -> None:
|
||||
"""create a new muxed connection.
|
||||
"""
|
||||
create a new muxed connection.
|
||||
|
||||
:param secured_conn: an instance of ``ISecureConn``
|
||||
:param generic_protocol_handler: generic protocol handler
|
||||
@ -82,14 +83,16 @@ class Mplex(IMuxedConn):
|
||||
await self.event_closed.wait()
|
||||
|
||||
def is_closed(self) -> bool:
|
||||
"""check connection is fully closed.
|
||||
"""
|
||||
check connection is fully closed.
|
||||
|
||||
:return: true if successful
|
||||
"""
|
||||
return self.event_closed.is_set()
|
||||
|
||||
def _get_next_channel_id(self) -> int:
|
||||
"""Get next available stream id.
|
||||
"""
|
||||
Get next available stream id.
|
||||
|
||||
:return: next available stream id for the connection
|
||||
"""
|
||||
@ -104,7 +107,8 @@ class Mplex(IMuxedConn):
|
||||
return stream
|
||||
|
||||
async def open_stream(self) -> IMuxedStream:
|
||||
"""creates a new muxed_stream.
|
||||
"""
|
||||
creates a new muxed_stream.
|
||||
|
||||
:return: a new ``MplexStream``
|
||||
"""
|
||||
@ -141,7 +145,8 @@ class Mplex(IMuxedConn):
|
||||
async def send_message(
|
||||
self, flag: HeaderTags, data: Optional[bytes], stream_id: StreamID
|
||||
) -> int:
|
||||
"""sends a message over the connection.
|
||||
"""
|
||||
sends a message over the connection.
|
||||
|
||||
:param header: header to use
|
||||
:param data: data to send in the message
|
||||
@ -160,7 +165,8 @@ class Mplex(IMuxedConn):
|
||||
)
|
||||
|
||||
async def write_to_stream(self, _bytes: bytes) -> int:
|
||||
"""writes a byte array to a secured connection.
|
||||
"""
|
||||
writes a byte array to a secured connection.
|
||||
|
||||
:param _bytes: byte array to write
|
||||
:return: length written
|
||||
@ -184,7 +190,8 @@ class Mplex(IMuxedConn):
|
||||
await self._cleanup()
|
||||
|
||||
async def read_message(self) -> Tuple[int, int, bytes]:
|
||||
"""Read a single message off of the secured connection.
|
||||
"""
|
||||
Read a single message off of the secured connection.
|
||||
|
||||
:return: stream_id, flag, message contents
|
||||
"""
|
||||
@ -210,7 +217,8 @@ class Mplex(IMuxedConn):
|
||||
return channel_id, flag, message
|
||||
|
||||
async def _handle_incoming_message(self) -> None:
|
||||
"""Read and handle a new incoming message.
|
||||
"""
|
||||
Read and handle a new incoming message.
|
||||
|
||||
:raise MplexUnavailable: `Mplex` encounters fatal error or is shutting down.
|
||||
"""
|
||||
|
||||
@ -34,7 +34,8 @@ class MplexStream(IMuxedStream):
|
||||
_buf: bytearray
|
||||
|
||||
def __init__(self, name: str, stream_id: StreamID, muxed_conn: "Mplex") -> None:
|
||||
"""create new MuxedStream in muxer.
|
||||
"""
|
||||
create new MuxedStream in muxer.
|
||||
|
||||
:param stream_id: stream id of this stream
|
||||
:param muxed_conn: muxed connection of this muxed_stream
|
||||
@ -112,7 +113,8 @@ class MplexStream(IMuxedStream):
|
||||
return bytes(payload)
|
||||
|
||||
async def read(self, n: int = -1) -> bytes:
|
||||
"""Read up to n bytes. Read possibly returns fewer than `n` bytes, if
|
||||
"""
|
||||
Read up to n bytes. Read possibly returns fewer than `n` bytes, if
|
||||
there are not enough bytes in the Mplex buffer. If `n == -1`, read
|
||||
until EOF.
|
||||
|
||||
@ -141,7 +143,8 @@ class MplexStream(IMuxedStream):
|
||||
return bytes(payload)
|
||||
|
||||
async def write(self, data: bytes) -> int:
|
||||
"""write to stream.
|
||||
"""
|
||||
write to stream.
|
||||
|
||||
:return: number of bytes written
|
||||
"""
|
||||
@ -212,7 +215,8 @@ class MplexStream(IMuxedStream):
|
||||
|
||||
# TODO deadline not in use
|
||||
def set_deadline(self, ttl: int) -> bool:
|
||||
"""set deadline for muxed stream.
|
||||
"""
|
||||
set deadline for muxed stream.
|
||||
|
||||
:return: True if successful
|
||||
"""
|
||||
@ -221,7 +225,8 @@ class MplexStream(IMuxedStream):
|
||||
return True
|
||||
|
||||
def set_read_deadline(self, ttl: int) -> bool:
|
||||
"""set read deadline for muxed stream.
|
||||
"""
|
||||
set read deadline for muxed stream.
|
||||
|
||||
:return: True if successful
|
||||
"""
|
||||
@ -229,7 +234,8 @@ class MplexStream(IMuxedStream):
|
||||
return True
|
||||
|
||||
def set_write_deadline(self, ttl: int) -> bool:
|
||||
"""set write deadline for muxed stream.
|
||||
"""
|
||||
set write deadline for muxed stream.
|
||||
|
||||
:return: True if successful
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user