Skip to content

Commit

Permalink
Merge branch 'dev' into no-float-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
janiversen authored Feb 24, 2023
2 parents 12c28f5 + b475772 commit 4ee084d
Show file tree
Hide file tree
Showing 32 changed files with 335 additions and 444 deletions.
2 changes: 2 additions & 0 deletions API_changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Version 3.2.0
- `ReturnSlaveNoReponseCountResponse` has been corrected to
`ReturnSlaveNoResponseCountResponse`
- Option `--modbus-config` for REPL server renamed to `--modbus-config-path`
- client.protocol.<something> --> client.<something>
- client.factory.<something> --> client.<something>

-------------
Version 3.1.0
Expand Down
2 changes: 1 addition & 1 deletion examples/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async def run_async_client(client, modbus_calls=None):
"""Run sync client."""
_logger.info("### Client starting")
await client.connect()
assert client.protocol
assert client.connected
if modbus_calls:
await modbus_calls(client)
await client.close()
Expand Down
4 changes: 2 additions & 2 deletions examples/client_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ async def run_payload_calls(client):
# Make sure word/byte order is consistent between BinaryPayloadBuilder and BinaryPayloadDecoder
assert (
decoder._byteorder == builder._byteorder # pylint: disable=protected-access
) # nosec
)
assert (
decoder._wordorder == builder._wordorder # pylint: disable=protected-access
) # nosec
)

decoded = OrderedDict(
[
Expand Down
4 changes: 2 additions & 2 deletions examples/v2.5.3/changing_framers.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
# ----------------------------------------------------------------------- #
rq = client.write_coil(1, True)
rr = client.read_coils(1, 1)
assert not rq.isError() # nosec test that we are not an error
assert rr.bits[0] # nosec test the expected value
assert not rq.isError() # test that we are not an error
assert rr.bits[0] # test the expected value

# ----------------------------------------------------------------------- #
# close the client
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 @@ -111,7 +111,7 @@ def _client_worker_process(factory, input_queue, output_queue, is_shutdown):
txt = f"error in worker thread: {threading.current_thread()}"
log.exception(txt)
output_queue.put(WorkResponse(True, workitem.work_id, exc))
except Exception: # nosec pylint: disable=broad-except
except Exception: # pylint: disable=broad-except
pass
txt = f"request worker shutting down: {threading.current_thread()}"
log.info(txt)
Expand Down
4 changes: 2 additions & 2 deletions examples/v2.5.3/dbstore_update_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def updating_writer(parm1):

# import pdb; pdb.set_trace()

rand_value = random.randint(0, 9999) # nosec
rand_addr = random.randint(0, 65000) # nosec
rand_value = random.randint(0, 9999)
rand_addr = random.randint(0, 65000)
txt = f"Writing to datastore: {rand_addr}, {rand_value}"
log.debug(txt)
# import pdb; pdb.set_trace()
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/modbus_saver.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* handle_save_end(self)
"""
import json
import xml.etree.ElementTree as xml # nosec
import xml.etree.ElementTree as xml


class ModbusDatastoreSaver:
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 @@ -5,7 +5,7 @@
with read/write data as well as user configurable base data
"""
import logging
import pickle # nosec
import pickle
from optparse import OptionParser # pylint: disable=deprecated-module

from pymodbus.datastore import ModbusServerContext, ModbusSlaveContext
Expand Down Expand Up @@ -82,7 +82,7 @@ def __init__(self, config):

def parse(self):
"""Parse the config file and creates a server context"""
handle = pickle.load(self.file) # nosec
handle = pickle.load(self.file)
try: # test for existence, or bomb
dsd = handle["di"]
csd = handle["ci"]
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/tornado_twisted/async_tornado_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def dassert(future, callback):

def _assertor(value):
# by pass assertion, an error here stops the write callbacks
assert value # nosec
assert value

def on_done(f_trans):
if exc := f_trans.exception():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# import needed libraries
# ---------------------------------------------------------------------------#
import logging
from tempfile import gettempdir

from tornado.ioloop import IOLoop

Expand Down Expand Up @@ -45,7 +46,7 @@ def dassert(future, callback):

def _assertor(value):
# by pass assertion, an error here stops the write callbacks
assert value # nosec
assert value

def on_done(f_trans):
if exc := f_trans.exception():
Expand Down Expand Up @@ -170,7 +171,7 @@ def callback(protocol, future):
) = AsyncModbusSerialClient( # pylint: disable=unpacking-non-sequence
schedulers.IO_LOOP,
method="rtu",
port="/tmp/ptyp0", # nosec
port=gettempdir() + "/ptyp0",
baudrate=9600,
timeout=2,
)
Expand Down
2 changes: 1 addition & 1 deletion examples/v2.5.3/tornado_twisted/async_twisted_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def dassert(deferred, callback):
"""Dassert."""

def _assertor(value):
assert value # nosec
assert value

deferred.addCallback(lambda r: _assertor(callback(r)))
deferred.addErrback(err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
client implementation from pymodbus with twisted.
"""
import logging
from tempfile import gettempdir

from twisted.internet import reactor

Expand All @@ -20,7 +21,7 @@
# state a few constants
# ---------------------------------------------------------------------------#

SERIAL_PORT = "/tmp/ptyp0" # nosec
SERIAL_PORT = gettempdir() + "/ptyp0"
STATUS_REGS = (1, 2)
STATUS_COILS = (1, 3)
CLIENT_DELAY = 1
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 @@ -5,7 +5,7 @@
them as a collection of sequential data blocks.
"""
import logging
import pickle # nosec
import pickle
from optparse import OptionParser

from twisted.internet import ( # pylint: disable=import-error
Expand Down
Loading

0 comments on commit 4ee084d

Please sign in to comment.