mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Enforce pre-summary newline in docstrings
This commit is contained in:
@ -11,8 +11,9 @@ def default_secure_bytes_provider(n: int) -> bytes:
|
||||
|
||||
|
||||
class BaseSecureTransport(ISecureTransport):
|
||||
"""``BaseSecureTransport`` is not fully instantiated from its abstract
|
||||
classes as it is only meant to be used in clases that derive from it.
|
||||
"""
|
||||
``BaseSecureTransport`` is not fully instantiated from its abstract classes
|
||||
as it is only meant to be used in clases that derive from it.
|
||||
|
||||
Clients can provide a strategy to get cryptographically secure bytes
|
||||
of a given length. A default implementation is provided using the
|
||||
|
||||
@ -104,8 +104,9 @@ class InsecureTransport(BaseSecureTransport):
|
||||
security."""
|
||||
|
||||
async def secure_inbound(self, conn: IRawConnection) -> ISecureConn:
|
||||
"""Secure the connection, either locally or by communicating with
|
||||
opposing node via conn, for an inbound connection (i.e. we are not the
|
||||
"""
|
||||
Secure the connection, either locally or by communicating with opposing
|
||||
node via conn, for an inbound connection (i.e. we are not the
|
||||
initiator)
|
||||
|
||||
:return: secure connection object (that implements secure_conn_interface)
|
||||
@ -115,9 +116,9 @@ class InsecureTransport(BaseSecureTransport):
|
||||
return session
|
||||
|
||||
async def secure_outbound(self, conn: IRawConnection, peer_id: ID) -> ISecureConn:
|
||||
"""Secure the connection, either locally or by communicating with
|
||||
opposing node via conn, for an inbound connection (i.e. we are the
|
||||
initiator)
|
||||
"""
|
||||
Secure the connection, either locally or by communicating with opposing
|
||||
node via conn, for an inbound connection (i.e. we are the initiator)
|
||||
|
||||
:return: secure connection object (that implements secure_conn_interface)
|
||||
"""
|
||||
|
||||
@ -394,7 +394,8 @@ async def create_secure_session(
|
||||
conn: IRawConnection,
|
||||
remote_peer: PeerID = None,
|
||||
) -> ISecureConn:
|
||||
"""Attempt the initial `secio` handshake with the remote peer.
|
||||
"""
|
||||
Attempt the initial `secio` handshake with the remote peer.
|
||||
|
||||
If successful, return an object that provides secure communication
|
||||
to the ``remote_peer``. Raise `SecioException` when `conn` closed.
|
||||
@ -435,8 +436,9 @@ class Transport(BaseSecureTransport):
|
||||
return self.secure_bytes_provider(NONCE_SIZE)
|
||||
|
||||
async def secure_inbound(self, conn: IRawConnection) -> ISecureConn:
|
||||
"""Secure the connection, either locally or by communicating with
|
||||
opposing node via conn, for an inbound connection (i.e. we are not the
|
||||
"""
|
||||
Secure the connection, either locally or by communicating with opposing
|
||||
node via conn, for an inbound connection (i.e. we are not the
|
||||
initiator)
|
||||
|
||||
:return: secure connection object (that implements secure_conn_interface)
|
||||
@ -452,9 +454,9 @@ class Transport(BaseSecureTransport):
|
||||
async def secure_outbound(
|
||||
self, conn: IRawConnection, peer_id: PeerID
|
||||
) -> ISecureConn:
|
||||
"""Secure the connection, either locally or by communicating with
|
||||
opposing node via conn, for an inbound connection (i.e. we are the
|
||||
initiator)
|
||||
"""
|
||||
Secure the connection, either locally or by communicating with opposing
|
||||
node via conn, for an inbound connection (i.e. we are the initiator)
|
||||
|
||||
:return: secure connection object (that implements secure_conn_interface)
|
||||
"""
|
||||
|
||||
@ -16,8 +16,9 @@ Relevant go repo: https://github.com/libp2p/go-conn-security/blob/master/interfa
|
||||
class ISecureTransport(ABC):
|
||||
@abstractmethod
|
||||
async def secure_inbound(self, conn: IRawConnection) -> ISecureConn:
|
||||
"""Secure the connection, either locally or by communicating with
|
||||
opposing node via conn, for an inbound connection (i.e. we are not the
|
||||
"""
|
||||
Secure the connection, either locally or by communicating with opposing
|
||||
node via conn, for an inbound connection (i.e. we are not the
|
||||
initiator)
|
||||
|
||||
:return: secure connection object (that implements secure_conn_interface)
|
||||
@ -25,9 +26,9 @@ class ISecureTransport(ABC):
|
||||
|
||||
@abstractmethod
|
||||
async def secure_outbound(self, conn: IRawConnection, peer_id: ID) -> ISecureConn:
|
||||
"""Secure the connection, either locally or by communicating with
|
||||
opposing node via conn, for an inbound connection (i.e. we are the
|
||||
initiator)
|
||||
"""
|
||||
Secure the connection, either locally or by communicating with opposing
|
||||
node via conn, for an inbound connection (i.e. we are the initiator)
|
||||
|
||||
:return: secure connection object (that implements secure_conn_interface)
|
||||
"""
|
||||
|
||||
@ -21,7 +21,8 @@ Relevant go repo: https://github.com/libp2p/go-conn-security/blob/master/interfa
|
||||
|
||||
|
||||
class SecurityMultistream(ABC):
|
||||
"""SSMuxer is a multistream stream security transport multiplexer.
|
||||
"""
|
||||
SSMuxer is a multistream stream security transport multiplexer.
|
||||
|
||||
Go implementation: github.com/libp2p/go-conn-security-multistream/ssms.go
|
||||
"""
|
||||
@ -40,7 +41,8 @@ class SecurityMultistream(ABC):
|
||||
self.add_transport(protocol, transport)
|
||||
|
||||
def add_transport(self, protocol: TProtocol, transport: ISecureTransport) -> None:
|
||||
"""Add a protocol and its corresponding transport to multistream-
|
||||
"""
|
||||
Add a protocol and its corresponding transport to multistream-
|
||||
select(multiselect). The order that a protocol is added is exactly the
|
||||
precedence it is negotiated in multiselect.
|
||||
|
||||
@ -56,8 +58,9 @@ class SecurityMultistream(ABC):
|
||||
self.multiselect.add_handler(protocol, None)
|
||||
|
||||
async def secure_inbound(self, conn: IRawConnection) -> ISecureConn:
|
||||
"""Secure the connection, either locally or by communicating with
|
||||
opposing node via conn, for an inbound connection (i.e. we are not the
|
||||
"""
|
||||
Secure the connection, either locally or by communicating with opposing
|
||||
node via conn, for an inbound connection (i.e. we are not the
|
||||
initiator)
|
||||
|
||||
:return: secure connection object (that implements secure_conn_interface)
|
||||
@ -67,9 +70,9 @@ class SecurityMultistream(ABC):
|
||||
return secure_conn
|
||||
|
||||
async def secure_outbound(self, conn: IRawConnection, peer_id: ID) -> ISecureConn:
|
||||
"""Secure the connection, either locally or by communicating with
|
||||
opposing node via conn, for an inbound connection (i.e. we are the
|
||||
initiator)
|
||||
"""
|
||||
Secure the connection, either locally or by communicating with opposing
|
||||
node via conn, for an inbound connection (i.e. we are the initiator)
|
||||
|
||||
:return: secure connection object (that implements secure_conn_interface)
|
||||
"""
|
||||
@ -80,8 +83,9 @@ class SecurityMultistream(ABC):
|
||||
async def select_transport(
|
||||
self, conn: IRawConnection, initiator: bool
|
||||
) -> ISecureTransport:
|
||||
"""Select a transport that both us and the node on the other end of
|
||||
conn support and agree on.
|
||||
"""
|
||||
Select a transport that both us and the node on the other end of conn
|
||||
support and agree on.
|
||||
|
||||
:param conn: conn to choose a transport over
|
||||
:param initiator: true if we are the initiator, false otherwise
|
||||
|
||||
Reference in New Issue
Block a user