Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/client_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ async def run_payload_calls(client):
If you need to build a complex message to send, you can use the payload
builder to simplify the packing logic

Packing/unpacking depends on your CPU´s word/byte order. Modbus messages
are always using big endian. BinaryPayloadBuilder will pr default use
Packing/unpacking depends on your CPU's word/byte order. Modbus messages
are always using big endian. BinaryPayloadBuilder will per default use
what your CPU uses.
The wordorder is applicable only for 32 and 64 bit values
Lets say we need to write a value 0x12345678 to a 32 bit register
Expand Down
2 changes: 1 addition & 1 deletion examples/server_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def setup_server(args):
# ----------------------------------------------------------------------- #
# initialize the server information
# ----------------------------------------------------------------------- #
# If you don"t set this or any fields, they are defaulted to empty strings.
# If you don't set this or any fields, they are defaulted to empty strings.
# ----------------------------------------------------------------------- #
args.identity = ModbusDeviceIdentification(
info_name={
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/asynchronous_asyncio_modbus_tls_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
sslctx.verify_mode = ssl.CERT_REQUIRED
sslctx.check_hostname = True

# Prepare client"s certificate which the server requires for TLS full handshake
# Prepare client's certificate which the server requires for TLS full handshake
# sslctx.load_cert_chain(certfile="client.crt", keyfile="client.key",
# password="pwd")

Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/concurrent_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def execute(self, request):
of the call.

:param request: The request to execute
:returns: A future linked to the call"s response
:returns: A future linked to the call's response
"""
fut, work_id = Future(), next(self.counter)
self.input_queue.put(WorkRequest(request, work_id))
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/custom_synchronous_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def run_server():
# ----------------------------------------------------------------------- #
# initialize the server information
# ----------------------------------------------------------------------- #
# If you don"t set this or any fields, they are defaulted to empty strings.
# If you don't set this or any fields, they are defaulted to empty strings.
# ----------------------------------------------------------------------- #
identity = ModbusDeviceIdentification(
info_name={
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/deviceinfo_showcase_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def run_server():
# ----------------------------------------------------------------------- #
# initialize the server information
# ----------------------------------------------------------------------- #
# If you don"t set this or any fields, they are defaulted to empty strings.
# If you don't set this or any fields, they are defaulted to empty strings.
# ----------------------------------------------------------------------- #
identity = ModbusDeviceIdentification(
info_name={
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/libmodbus_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class NotImplementedException(Exception):
class LibmodbusLevel1Client:
"""A raw wrapper around the libmodbus c library.

Feel free to use it if you want increased performance and don"t mind the
Feel free to use it if you want increased performance and don't mind the
entire protocol not being implemented.
"""

Expand Down
4 changes: 2 additions & 2 deletions examples/v2.5.3/modbus_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
# -------------------------------------------------------------------------- #
# Extra Global Functions
# -------------------------------------------------------------------------- #
# These are extra helper functions that don"t belong in a class
# These are extra helper functions that don't belong in a class
# -------------------------------------------------------------------------- #
# import getpass


def root_test():
"""Check to see if we are running as root"""
return True # removed for the time being as it isn"t portable
return True # removed for the time being as it isn't portable
# return getpass.getuser() == "root"


Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/modbus_tls_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
sslctx.verify_mode = ssl.CERT_REQUIRED
sslctx.check_hostname = True

# Prepare client"s certificate which the server requires for TLS full handshake
# Prepare client's certificate which the server requires for TLS full handshake
# sslctx.load_cert_chain(certfile="client.crt", keyfile="client.key",
# password="pwd")

Expand Down
6 changes: 3 additions & 3 deletions examples/v2.5.3/remote_server_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def __contains__(self, slave):
:param slave: slave The slave to check for existence
:returns: True if the slave exists, False otherwise
"""
# we don"t want to check the cache here as the
# we don't want to check the cache here as the
# slave may not exist yet or may not exist any
# more. The best thing to do is try and fail.
return True
Expand All @@ -209,14 +209,14 @@ def __setitem__(self, slave, context):
:param slave: The slave context to set
:param context: The new context to set for this slave
"""
raise NotImplementedException() # doesn"t make sense here
raise NotImplementedException() # doesn't make sense here

def __delitem__(self, slave):
"""Use to access the slave context

:param slave: The slave context to remove
"""
raise NotImplementedException() # doesn"t make sense here
raise NotImplementedException() # doesn't make sense here

def __getitem__(self, slave):
"""Use to get access to a slave context
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/tornado_twisted/asynchronous_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def error_handler(self, failure):
# --------------------------------------------------------------------------- #
# a factory for the example protocol
# --------------------------------------------------------------------------- #
# This is used to build client protocol"s if you tie into twisted"s method
# This is used to build client protocol's if you tie into twisted's method
# of processing. It basically produces client instances of the underlying
# protocol::
#
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/tornado_twisted/asynchronous_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def run_async_server():
# ----------------------------------------------------------------------- #
# initialize the server information
# ----------------------------------------------------------------------- #
# If you don"t set this or any fields, they are defaulted to empty strings.
# If you don't set this or any fields, they are defaulted to empty strings.
# ----------------------------------------------------------------------- #
identity = ModbusDeviceIdentification(
info_name={
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/tornado_twisted/modbus_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def error_handler(self, failure):
# --------------------------------------------------------------------------- #
# a factory for the example protocol
# --------------------------------------------------------------------------- #
# This is used to build client protocol"s if you tie into twisted"s method
# This is used to build client protocol's if you tie into twisted's method
# of processing. It basically produces client instances of the underlying
# protocol::
#
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/bit_read_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def resetBit(self, address): # pylint: disable=invalid-name
self.setBit(address, 0)

def getBit(self, address): # pylint: disable=invalid-name
"""Get the specified bit"s value.
"""Get the specified bit's value.

:param address: The bit to query
:returns: The value of the requested bit
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ModbusBaseClient(ModbusClientMixin):

:param framer: (optional) Modbus Framer class.
:param timeout: (optional) Timeout for a request, in seconds.
:param retries: (optional) Max number of retries pr request.
:param retries: (optional) Max number of retries per request.
:param retry_on_empty: (optional) Retry on empty response.
:param close_comm_on_error: (optional) Close connection on error.
:param strict: (optional) Strict timing, 1.5 character between requests.
Expand Down
12 changes: 6 additions & 6 deletions pymodbus/client/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ class AsyncModbusSerialClient(ModbusBaseClient):

:param port: Serial port used for communication.
:param framer: (optional) Framer class.
:param baudrate: (optional) Bits pr second.
:param bytesize: (optional) Number of bits pr byte 7-8.
:param baudrate: (optional) Bits per second.
:param bytesize: (optional) Number of bits per byte 7-8.
:param parity: (optional) 'E'ven, 'O'dd or 'N'one
:param stopbits: (optional) Number of stop bits 0-2¡.
:param handle_local_echo: (optional) Discard local echo from dongle.
:param kwargs: (optional) Experimental parameters

The serial communication is RS-485 based, and usually used vith a usb RS485 dongle.
The serial communication is RS-485 based, and usually used with a usb RS485 dongle.

Example::

Expand Down Expand Up @@ -153,14 +153,14 @@ class ModbusSerialClient(ModbusBaseClient):

:param port: Serial port used for communication.
:param framer: (optional) Framer class.
:param baudrate: (optional) Bits pr second.
:param bytesize: (optional) Number of bits pr byte 7-8.
:param baudrate: (optional) Bits per second.
:param bytesize: (optional) Number of bits per byte 7-8.
:param parity: (optional) 'E'ven, 'O'dd or 'N'one
:param stopbits: (optional) Number of stop bits 0-2¡.
:param handle_local_echo: (optional) Discard local echo from dongle.
:param kwargs: (optional) Experimental parameters

The serial communication is RS-485 based, and usually used vith a usb RS485 dongle.
The serial communication is RS-485 based, and usually used with a usb RS485 dongle.

Example::

Expand Down
2 changes: 1 addition & 1 deletion pymodbus/client/sync_diag.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def recv(self, size):

return result
except ConnectionException as exc:
# Only log actual network errors, "if not self.socket" then it"s a internal code issue
# Only log actual network errors, "if not self.socket" then it's a internal code issue
if "Connection unexpectedly closed" in exc.string:
_logger.error(LOG_MSGS["unexpected_dc_msg"], self, exc)
raise ConnectionException from exc
Expand Down
18 changes: 9 additions & 9 deletions pymodbus/client/tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class AsyncModbusTcpClient(ModbusBaseClient):
"""**AsyncModbusTcpClient**.

:param host: Host IP address or host name
:param port: (optional) Port used for communication.
:param framer: (optional) Framer class.
:param source_address: (optional) source address of client,
:param port: (optional) Port used for communication
:param framer: (optional) Framer class
:param source_address: (optional) source address of client
:param kwargs: (optional) Experimental parameters

Example::
Expand Down Expand Up @@ -153,9 +153,9 @@ class ModbusTcpClient(ModbusBaseClient):
"""**ModbusTcpClient**.

:param host: Host IP address or host name
:param port: (optional) Port used for communication.
:param framer: (optional) Framer class.
:param source_address: (optional) source address of client,
:param port: (optional) Port used for communication
:param framer: (optional) Framer class
:param source_address: (optional) source address of client
:param kwargs: (optional) Experimental parameters

Example::
Expand Down Expand Up @@ -257,7 +257,7 @@ def recv(self, size):

timeout = self.params.timeout

# If size isn"t specified read up to 4096 bytes at a time.
# If size isn't specified read up to 4096 bytes at a time.
if size is None:
recv_size = 4096
else:
Expand All @@ -281,12 +281,12 @@ def recv(self, size):
data_length += len(recv_data)
time_ = time.time()

# If size isn"t specified continue to read until timeout expires.
# If size isn't specified continue to read until timeout expires.
if size:
recv_size = size - data_length

# Timeout is reduced also if some data has been received in order
# to avoid infinite loops when there isn"t an expected response
# to avoid infinite loops when there isn't an expected response
# size and the slave sends noisy data continuously.
if time_ > end:
break
Expand Down
28 changes: 14 additions & 14 deletions pymodbus/client/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def sslctx_provider(

:param sslctx: The user defined SSLContext to use for TLS (default None and
auto create)
:param certfile: The optional client"s cert file path for TLS server request
:param keyfile: The optional client"s key file path for TLS server request
:param password: The password for for decrypting client"s private key file
:param certfile: The optional client's cert file path for TLS server request
:param keyfile: The optional client's key file path for TLS server request
:param password: The password for decrypting client's private key file
"""
if sslctx:
return sslctx
Expand All @@ -46,15 +46,15 @@ class AsyncModbusTlsClient(AsyncModbusTcpClient):
"""**AsyncModbusTlsClient**.

:param host: Host IP address or host name
:param port: (optional) Port used for communication.
:param framer: (optional) Framer class.
:param source_address: (optional) Source address of client,
:param port: (optional) Port used for communication
:param framer: (optional) Framer class
:param source_address: (optional) Source address of client
:param sslctx: (optional) SSLContext to use for TLS
:param certfile: (optional) Cert file path for TLS server request
:param keyfile: (optional) Key file path for TLS server request
:param password: (optional) Password for for decrypting private key file
:param server_hostname: (optional) Bind certificate to host,
:param kwargs: (optional) Experimental parameters.
:param server_hostname: (optional) Bind certificate to host
:param kwargs: (optional) Experimental parameters

Example::

Expand Down Expand Up @@ -116,15 +116,15 @@ class ModbusTlsClient(ModbusTcpClient):
"""**ModbusTlsClient**.

:param host: Host IP address or host name
:param port: (optional) Port used for communication.
:param framer: (optional) Framer class.
:param source_address: (optional) Source address of client,
:param port: (optional) Port used for communication
:param framer: (optional) Framer class
:param source_address: (optional) Source address of client
:param sslctx: (optional) SSLContext to use for TLS
:param certfile: (optional) Cert file path for TLS server request
:param keyfile: (optional) Key file path for TLS server request
:param password: (optional) Password for for decrypting private key file
:param server_hostname: (optional) Bind certificate to host,
:param kwargs: (optional) Experimental parameters.
:param password: (optional) Password for decrypting private key file
:param server_hostname: (optional) Bind certificate to host
:param kwargs: (optional) Experimental parameters

Example::

Expand Down
8 changes: 4 additions & 4 deletions pymodbus/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ class Defaults(Singleton): # pylint: disable=too-few-public-methods

.. attribute:: ProtocolId

The modbus protocol id. Currently this is set to 0 in all
The modbus protocol id. Currently, this is set to 0 in all
but proprietary implementations.

.. attribute:: Slave

The modbus slave address. Currently this is set to 0x00 which
The modbus slave address. Currently, this is set to 0x00 which
means this request should be broadcast to all the slave devices
(really means that all the devices should respond).

Expand Down Expand Up @@ -188,11 +188,11 @@ class Endian(Singleton): # pylint: disable=too-few-public-methods

.. attribute:: Big

This indicates that the bytes are in little endian format
This indicates that the bytes are in big endian format

.. attribute:: Little

This indicates that the bytes are in big endian format
This indicates that the bytes are in little endian format

.. note:: I am simply borrowing the format strings from the
python struct module for my convenience.
Expand Down
4 changes: 2 additions & 2 deletions pymodbus/diag_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def __init__(self, toggle=False, **kwargs):
# Diagnostic Sub Code 02
# ---------------------------------------------------------------------------#
class ReturnDiagnosticRegisterRequest(DiagnosticStatusSimpleRequest):
"""The contents of the remote device"s 16-bit diagnostic register are returned in the response."""
"""The contents of the remote device's 16-bit diagnostic register are returned in the response."""

sub_function_code = 0x0002

Expand All @@ -313,7 +313,7 @@ def execute(self, *args):
class ReturnDiagnosticRegisterResponse(DiagnosticStatusSimpleResponse):
"""Return diagnostic register.

The contents of the remote device"s 16-bit diagnostic register are
The contents of the remote device's 16-bit diagnostic register are
returned in the response
"""

Expand Down
2 changes: 1 addition & 1 deletion pymodbus/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The following factories make it easy to decode request/response messages.
To add a new request/response pair to be decodeable by the library, simply
add them to the respective function lookup table (order doesn"t matter, but
add them to the respective function lookup table (order doesn't matter, but
it does help keep things organized).

Regardless of how many functions are added to the lookup, O(1) behavior is
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/framer/ascii_framer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def resetFrame(self): # pylint: disable=invalid-name
This allows us to skip ovver errors that may be in the stream.
It is hard to know if we are simply out of sync or if there is
an error in the stream as we have no way to check the start or
end of the message (python just doesn"t have the resolution to
end of the message (python just doesn't have the resolution to
check for millisecond delays).
"""
self._buffer = b""
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/framer/binary_framer.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def resetFrame(self): # pylint: disable=invalid-name
This allows us to skip ovver errors that may be in the stream.
It is hard to know if we are simply out of sync or if there is
an error in the stream as we have no way to check the start or
end of the message (python just doesn"t have the resolution to
end of the message (python just doesn't have the resolution to
check for millisecond delays).
"""
self._buffer = b""
Expand Down
2 changes: 1 addition & 1 deletion pymodbus/framer/rtu_framer.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def resetFrame(self): # pylint: disable=invalid-name
This allows us to skip over errors that may be in the stream.
It is hard to know if we are simply out of sync or if there is
an error in the stream as we have no way to check the start or
end of the message (python just doesn"t have the resolution to
end of the message (python just doesn't have the resolution to
check for millisecond delays).
"""
txt = (
Expand Down
Loading