Add automatic docstring formatter and apply

This commit is contained in:
Dominik Muhs
2019-10-24 08:41:10 +02:00
parent 30aeb35122
commit eef505f2d9
74 changed files with 565 additions and 760 deletions

View File

@ -22,8 +22,8 @@ class TCPListener(IListener):
self.handler = handler_function
async def listen(self, maddr: Multiaddr) -> bool:
"""
put listener in listening mode and wait for incoming connections
"""put listener in listening mode and wait for incoming connections.
:param maddr: maddr of peer
:return: return True if successful
"""
@ -38,18 +38,16 @@ class TCPListener(IListener):
return True
def get_addrs(self) -> List[Multiaddr]:
"""
retrieve list of addresses the listener is listening on
"""retrieve list of addresses the listener is listening on.
:return: return list of addrs
"""
# TODO check if server is listening
return self.multiaddrs
async def close(self) -> None:
"""
close the listener such that no more connections
can be open on this transport instance
"""
"""close the listener such that no more connections can be open on this
transport instance."""
if self.server is None:
return
self.server.close()
@ -59,8 +57,8 @@ class TCPListener(IListener):
class TCP(ITransport):
async def dial(self, maddr: Multiaddr) -> IRawConnection:
"""
dial a transport to peer listening on multiaddr
"""dial a transport to peer listening on multiaddr.
:param maddr: multiaddr of peer
:return: `RawConnection` if successful
:raise OpenConnectionError: raised when failed to open connection
@ -76,10 +74,10 @@ class TCP(ITransport):
return RawConnection(reader, writer, True)
def create_listener(self, handler_function: THandler) -> TCPListener:
"""
create listener on transport
"""create listener on transport.
:param handler_function: a function called when a new connection is received
that takes a connection as argument which implements interface-connection
that takes a connection as argument which implements interface-connection
:return: a listener object that implements listener_interface.py
"""
return TCPListener(handler_function)