mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-11 07:30:55 +00:00
Enforce pre-summary newline in docstrings
This commit is contained in:
@ -21,7 +21,8 @@ class Multiselect(IMultiselectMuxer):
|
||||
self.handlers = {}
|
||||
|
||||
def add_handler(self, protocol: TProtocol, handler: StreamHandlerFn) -> None:
|
||||
"""Store the handler with the given protocol.
|
||||
"""
|
||||
Store the handler with the given protocol.
|
||||
|
||||
:param protocol: protocol name
|
||||
:param handler: handler function
|
||||
@ -31,7 +32,8 @@ class Multiselect(IMultiselectMuxer):
|
||||
async def negotiate(
|
||||
self, communicator: IMultiselectCommunicator
|
||||
) -> Tuple[TProtocol, StreamHandlerFn]:
|
||||
"""Negotiate performs protocol selection.
|
||||
"""
|
||||
Negotiate performs protocol selection.
|
||||
|
||||
:param stream: stream to negotiate on
|
||||
:return: selected protocol name, handler function
|
||||
@ -63,7 +65,8 @@ class Multiselect(IMultiselectMuxer):
|
||||
raise MultiselectError(error)
|
||||
|
||||
async def handshake(self, communicator: IMultiselectCommunicator) -> None:
|
||||
"""Perform handshake to agree on multiselect protocol.
|
||||
"""
|
||||
Perform handshake to agree on multiselect protocol.
|
||||
|
||||
:param communicator: communicator to use
|
||||
:raise MultiselectError: raised when handshake failed
|
||||
@ -86,7 +89,8 @@ class Multiselect(IMultiselectMuxer):
|
||||
|
||||
|
||||
def validate_handshake(handshake_contents: str) -> bool:
|
||||
"""Determine if handshake is valid and should be confirmed.
|
||||
"""
|
||||
Determine if handshake is valid and should be confirmed.
|
||||
|
||||
:param handshake_contents: contents of handshake message
|
||||
:return: true if handshake is complete, false otherwise
|
||||
|
||||
@ -15,7 +15,8 @@ class MultiselectClient(IMultiselectClient):
|
||||
select a protocol id to communicate over."""
|
||||
|
||||
async def handshake(self, communicator: IMultiselectCommunicator) -> None:
|
||||
"""Ensure that the client and multiselect are both using the same
|
||||
"""
|
||||
Ensure that the client and multiselect are both using the same
|
||||
multiselect protocol.
|
||||
|
||||
:param stream: stream to communicate with multiselect over
|
||||
@ -37,8 +38,9 @@ class MultiselectClient(IMultiselectClient):
|
||||
async def select_one_of(
|
||||
self, protocols: Sequence[TProtocol], communicator: IMultiselectCommunicator
|
||||
) -> TProtocol:
|
||||
"""For each protocol, send message to multiselect selecting protocol
|
||||
and fail if multiselect does not return same protocol. Returns first
|
||||
"""
|
||||
For each protocol, send message to multiselect selecting protocol and
|
||||
fail if multiselect does not return same protocol. Returns first
|
||||
protocol that multiselect agrees on (i.e. that multiselect selects)
|
||||
|
||||
:param protocol: protocol to select
|
||||
@ -60,7 +62,8 @@ class MultiselectClient(IMultiselectClient):
|
||||
async def try_select(
|
||||
self, communicator: IMultiselectCommunicator, protocol: TProtocol
|
||||
) -> TProtocol:
|
||||
"""Try to select the given protocol or raise exception if fails.
|
||||
"""
|
||||
Try to select the given protocol or raise exception if fails.
|
||||
|
||||
:param communicator: communicator to use to communicate with counterparty
|
||||
:param protocol: protocol to select
|
||||
@ -85,7 +88,8 @@ class MultiselectClient(IMultiselectClient):
|
||||
|
||||
|
||||
def validate_handshake(handshake_contents: str) -> bool:
|
||||
"""Determine if handshake is valid and should be confirmed.
|
||||
"""
|
||||
Determine if handshake is valid and should be confirmed.
|
||||
|
||||
:param handshake_contents: contents of handshake message
|
||||
:return: true if handshake is complete, false otherwise
|
||||
|
||||
@ -12,7 +12,8 @@ class IMultiselectClient(ABC):
|
||||
select a protocol id to communicate over."""
|
||||
|
||||
async def handshake(self, communicator: IMultiselectCommunicator) -> None:
|
||||
"""Ensure that the client and multiselect are both using the same
|
||||
"""
|
||||
Ensure that the client and multiselect are both using the same
|
||||
multiselect protocol.
|
||||
|
||||
:param stream: stream to communicate with multiselect over
|
||||
@ -23,8 +24,9 @@ class IMultiselectClient(ABC):
|
||||
async def select_one_of(
|
||||
self, protocols: Sequence[TProtocol], communicator: IMultiselectCommunicator
|
||||
) -> TProtocol:
|
||||
"""For each protocol, send message to multiselect selecting protocol
|
||||
and fail if multiselect does not return same protocol. Returns first
|
||||
"""
|
||||
For each protocol, send message to multiselect selecting protocol and
|
||||
fail if multiselect does not return same protocol. Returns first
|
||||
protocol that multiselect agrees on (i.e. that multiselect selects)
|
||||
|
||||
:param protocol: protocol to select
|
||||
@ -35,7 +37,8 @@ class IMultiselectClient(ABC):
|
||||
async def try_select(
|
||||
self, communicator: IMultiselectCommunicator, protocol: TProtocol
|
||||
) -> TProtocol:
|
||||
"""Try to select the given protocol or raise exception if fails.
|
||||
"""
|
||||
Try to select the given protocol or raise exception if fails.
|
||||
|
||||
:param communicator: communicator to use to communicate with counterparty
|
||||
:param protocol: protocol to select
|
||||
|
||||
@ -8,7 +8,8 @@ class IMultiselectCommunicator(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def write(self, msg_str: str) -> None:
|
||||
"""Write message to stream.
|
||||
"""
|
||||
Write message to stream.
|
||||
|
||||
:param msg_str: message to write
|
||||
"""
|
||||
|
||||
@ -15,7 +15,8 @@ class IMultiselectMuxer(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def add_handler(self, protocol: TProtocol, handler: StreamHandlerFn) -> None:
|
||||
"""Store the handler with the given protocol.
|
||||
"""
|
||||
Store the handler with the given protocol.
|
||||
|
||||
:param protocol: protocol name
|
||||
:param handler: handler function
|
||||
@ -25,7 +26,8 @@ class IMultiselectMuxer(ABC):
|
||||
async def negotiate(
|
||||
self, communicator: IMultiselectCommunicator
|
||||
) -> Tuple[TProtocol, StreamHandlerFn]:
|
||||
"""Negotiate performs protocol selection.
|
||||
"""
|
||||
Negotiate performs protocol selection.
|
||||
|
||||
:param stream: stream to negotiate on
|
||||
:return: selected protocol name, handler function
|
||||
|
||||
Reference in New Issue
Block a user