Skip to content

Commit

Permalink
Add newlines to docstrings to stop docs breaking
Browse files Browse the repository at this point in the history
Without newlines, the docstring (including :params:, :return: etc) all
collapses onto a single line.
  • Loading branch information
camtarn authored and Andy Walker committed Dec 6, 2021
1 parent ec7d82c commit 71c5634
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pymodbus/client/asynchronous/async_io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class BaseModbusAsyncClientProtocol(AsyncModbusClientMixin):
async def execute(self, request=None):
"""
Executes requests asynchronously
:param request:
:return:
"""
Expand All @@ -40,6 +41,7 @@ def connection_made(self, transport):
Called when a connection is made.
The transport argument is the transport representing the connection.
:param transport:
:return:
"""
Expand All @@ -54,6 +56,7 @@ def connection_lost(self, reason):
Called when the connection is lost or closed.
The argument is either an exception object or None
:param reason:
:return:
"""
Expand All @@ -67,6 +70,7 @@ def data_received(self, data):
"""
Called when some data is received.
data is a non-empty bytes object containing the incoming data.
:param data:
:return:
"""
Expand All @@ -75,13 +79,15 @@ def data_received(self, data):
def create_future(self):
"""
Helper function to create asyncio Future object
:return:
"""
return asyncio.Future()

def resolve_future(self, f, result):
"""
Resolves the completed future and sets the result
:param f:
:param result:
:return:
Expand All @@ -92,6 +98,7 @@ def resolve_future(self, f, result):
def raise_future(self, f, exc):
"""
Sets exception of a future if not done
:param f:
:param exc:
:return:
Expand Down Expand Up @@ -198,6 +205,7 @@ def data_received(self, data):
"""
Called when some data is received.
data is a non-empty bytes object containing the incoming data.
:param data:
:return:
"""
Expand Down Expand Up @@ -237,6 +245,7 @@ class ReconnectingAsyncioModbusTcpClient(object):
def __init__(self, protocol_class=None, loop=None, **kwargs):
"""
Initialize ReconnectingAsyncioModbusTcpClient
:param protocol_class: Protocol used to talk to modbus device.
:param loop: Event loop to use
"""
Expand All @@ -263,6 +272,7 @@ def reset_delay(self):
def start(self, host, port=502):
"""
Initiates connection to start client
:param host:
:param port:
:return:
Expand All @@ -278,6 +288,7 @@ def start(self, host, port=502):
def stop(self):
"""
Stops client
:return:
"""
# prevent reconnect:
Expand Down Expand Up @@ -354,6 +365,7 @@ class AsyncioModbusTcpClient(object):
def __init__(self, host=None, port=502, protocol_class=None, loop=None, **kwargs):
"""
Initializes Asyncio Modbus Tcp Client
:param host: Host IP address
:param port: Port to connect
:param protocol_class: Protocol used to talk to modbus device.
Expand Down Expand Up @@ -444,6 +456,7 @@ class ReconnectingAsyncioModbusTlsClient(ReconnectingAsyncioModbusTcpClient):
def __init__(self, protocol_class=None, loop=None, framer=None, **kwargs):
"""
Initialize ReconnectingAsyncioModbusTcpClient
:param protocol_class: Protocol used to talk to modbus device.
:param loop: Event loop to use
"""
Expand All @@ -454,6 +467,7 @@ def __init__(self, protocol_class=None, loop=None, framer=None, **kwargs):
def start(self, host, port=802, sslctx=None, server_hostname=None):
"""
Initiates connection to start client
:param host:
:param port:
:param sslctx:
Expand Down Expand Up @@ -511,6 +525,7 @@ class ReconnectingAsyncioModbusUdpClient(object):
def __init__(self, protocol_class=None, loop=None, **kwargs):
"""
Initializes ReconnectingAsyncioModbusUdpClient
:param protocol_class: Protocol used to talk to modbus device.
:param loop: Asyncio Event loop
"""
Expand Down Expand Up @@ -538,6 +553,7 @@ def reset_delay(self):
def start(self, host, port=502):
"""
Start reconnecting asynchronous udp client
:param host: Host IP to connect
:param port: Host port to connect
:return:
Expand All @@ -561,6 +577,7 @@ def start(self, host, port=502):
def stop(self):
"""
Stops connection and prevents reconnect
:return:
"""
# prevent reconnect:
Expand Down Expand Up @@ -643,6 +660,7 @@ class AsyncioModbusUdpClient(object):
def __init__(self, host=None, port=502, protocol_class=None, loop=None, **kwargs):
"""
Initializes Asyncio Modbus UDP Client
:param host: Host IP address
:param port: Port to connect
:param protocol_class: Protocol used to talk to modbus device.
Expand All @@ -664,6 +682,7 @@ def __init__(self, host=None, port=502, protocol_class=None, loop=None, **kwargs
def stop(self):
"""
Stops connection
:return:
"""
# prevent reconnect:
Expand Down Expand Up @@ -745,6 +764,7 @@ def __init__(self, port, protocol_class=None, framer=None, loop=None,
baudrate=9600, bytesize=8, parity='N', stopbits=1, **serial_kwargs):
"""
Initializes Asyncio Modbus Serial Client
:param port: Port to connect
:param protocol_class: Protocol used to talk to modbus device.
:param framer: Framer to use
Expand All @@ -768,6 +788,7 @@ def __init__(self, port, protocol_class=None, framer=None, loop=None,
def stop(self):
"""
Stops connection
:return:
"""
if self._connected:
Expand All @@ -788,6 +809,7 @@ def _connected(self):
def connect(self):
"""
Connect Async client
:return:
"""
_logger.debug('Connecting.')
Expand Down Expand Up @@ -838,6 +860,7 @@ def protocol_lost_connection(self, protocol):
def init_tcp_client(proto_cls, loop, host, port, **kwargs):
"""
Helper function to initialize tcp client
:param proto_cls:
:param loop:
:param host:
Expand All @@ -856,6 +879,7 @@ def init_tls_client(proto_cls, loop, host, port, sslctx=None,
server_hostname=None, framer=None, **kwargs):
"""
Helper function to initialize tcp client
:param proto_cls:
:param loop:
:param host:
Expand All @@ -877,6 +901,7 @@ def init_tls_client(proto_cls, loop, host, port, sslctx=None,
def init_udp_client(proto_cls, loop, host, port, **kwargs):
"""
Helper function to initialize UDP client
:param proto_cls:
:param loop:
:param host:
Expand Down
4 changes: 4 additions & 0 deletions pymodbus/client/asynchronous/factory/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
def reactor_factory(port, framer, **kwargs):
"""
Factory to create twisted serial asynchronous client
:param port: Serial port
:param framer: Modbus Framer
:param kwargs:
Expand Down Expand Up @@ -59,6 +60,7 @@ def __init__(self, framer, *args, **kwargs):
def io_loop_factory(port=None, framer=None, **kwargs):
"""
Factory to create Tornado based asynchronous serial clients
:param port: Serial port
:param framer: Modbus Framer
:param kwargs:
Expand All @@ -82,6 +84,7 @@ def io_loop_factory(port=None, framer=None, **kwargs):
def async_io_factory(port=None, framer=None, **kwargs):
"""
Factory to create asyncio based asynchronous serial clients
:param port: Serial port
:param framer: Modbus Framer
:param kwargs: Serial port options
Expand Down Expand Up @@ -114,6 +117,7 @@ def async_io_factory(port=None, framer=None, **kwargs):
def get_factory(scheduler):
"""
Gets protocol factory based on the backend scheduler being used
:param scheduler: REACTOR/IO_LOOP/ASYNC_IO
:return:
"""
Expand Down
4 changes: 4 additions & 0 deletions pymodbus/client/asynchronous/factory/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def reactor_factory(host="127.0.0.1", port=Defaults.Port, framer=None,
source_address=None, timeout=None, **kwargs):
"""
Factory to create twisted tcp asynchronous client
:param host: Host IP address
:param port: Port
:param framer: Modbus Framer
Expand Down Expand Up @@ -52,6 +53,7 @@ def io_loop_factory(host="127.0.0.1", port=Defaults.Port, framer=None,
source_address=None, timeout=None, **kwargs):
"""
Factory to create Tornado based asynchronous tcp clients
:param host: Host IP address
:param port: Port
:param framer: Modbus Framer
Expand Down Expand Up @@ -80,6 +82,7 @@ def io_loop_factory(host="127.0.0.1", port=Defaults.Port, framer=None,
def async_io_factory(host="127.0.0.1", port=Defaults.Port, **kwargs):
"""
Factory to create asyncio based asynchronous tcp clients
:param host: Host IP address
:param port: Port
:param framer: Modbus Framer
Expand Down Expand Up @@ -107,6 +110,7 @@ def async_io_factory(host="127.0.0.1", port=Defaults.Port, **kwargs):
def get_factory(scheduler):
"""
Gets protocol factory based on the backend scheduler being used
:param scheduler: REACTOR/IO_LOOP/ASYNC_IO
:return
"""
Expand Down
2 changes: 2 additions & 0 deletions pymodbus/client/asynchronous/factory/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def async_io_factory(host="127.0.0.1", port=Defaults.TLSPort, sslctx=None,
server_hostname=None, framer=None, **kwargs):
"""
Factory to create asyncio based asynchronous tls clients
:param host: Host IP address
:param port: Port
:param sslctx: The SSLContext to use for TLS (default None and auto create)
Expand Down Expand Up @@ -47,6 +48,7 @@ def async_io_factory(host="127.0.0.1", port=Defaults.TLSPort, sslctx=None,
def get_factory(scheduler):
"""
Gets protocol factory based on the backend scheduler being used
:param scheduler: ASYNC_IO
:return
"""
Expand Down
4 changes: 4 additions & 0 deletions pymodbus/client/asynchronous/factory/udp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def reactor_factory(host="127.0.0.1", port=Defaults.Port, framer=None,
source_address=None, timeout=None, **kwargs):
"""
Factory to create twisted udp asynchronous client
:param host: Host IP address
:param port: Port
:param framer: Modbus Framer
Expand All @@ -29,6 +30,7 @@ def io_loop_factory(host="127.0.0.1", port=Defaults.Port, framer=None,
source_address=None, timeout=None, **kwargs):
"""
Factory to create Tornado based asynchronous udp clients
:param host: Host IP address
:param port: Port
:param framer: Modbus Framer
Expand All @@ -55,6 +57,7 @@ def io_loop_factory(host="127.0.0.1", port=Defaults.Port, framer=None,
def async_io_factory(host="127.0.0.1", port=Defaults.Port, **kwargs):
"""
Factory to create asyncio based asynchronous udp clients
:param host: Host IP address
:param port: Port
:param framer: Modbus Framer
Expand All @@ -79,6 +82,7 @@ def async_io_factory(host="127.0.0.1", port=Defaults.Port, **kwargs):
def get_factory(scheduler):
"""
Gets protocol factory based on the backend scheduler being used
:param scheduler: REACTOR/IO_LOOP/ASYNC_IO
:return
"""
Expand Down
Loading

0 comments on commit 71c5634

Please sign in to comment.