From 05e4ff96cad36612ee613576b00aba3f6967ebda Mon Sep 17 00:00:00 2001 From: Sven Sager Date: Fri, 20 Jan 2023 17:08:35 +0100 Subject: [PATCH] Code and project cleanup --- .gitignore | 2 +- MANIFEST.in | 3 ++- requirements.txt | 2 +- src/revpimodio2/io.py | 6 ++++-- src/revpimodio2/modio.py | 8 +++++--- src/revpimodio2/netio.py | 9 ++++----- stdeb.cfg | 1 - 7 files changed, 17 insertions(+), 14 deletions(-) delete mode 100644 stdeb.cfg diff --git a/.gitignore b/.gitignore index a5114a4..6c43b50 100644 --- a/.gitignore +++ b/.gitignore @@ -114,5 +114,5 @@ dmypy.json # Pyre type checker .pyre/ -/test/ /make.conf +/test_local/ diff --git a/MANIFEST.in b/MANIFEST.in index 7190361..be387ff 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,6 @@ -recursive-include src/revpimodio *.py include LICENSE.txt +include Makefile include MANIFEST.in include README.md +include requirements.txt include setup.py diff --git a/requirements.txt b/requirements.txt index d0ae7a7..ed42133 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -setuptools>=65.6.3 +setuptools>=58.0.4 wheel diff --git a/src/revpimodio2/io.py b/src/revpimodio2/io.py index 25b50eb..e35b4c6 100644 --- a/src/revpimodio2/io.py +++ b/src/revpimodio2/io.py @@ -176,7 +176,8 @@ class IOList(object): if type(oldio) == StructIO: # Hier gibt es schon einen neuen IO if oldio._bitshift: - if io._bitshift == oldio._bitshift and io._slc_address == oldio._slc_address: + if io._bitshift == oldio._bitshift \ + and io._slc_address == oldio._slc_address: raise MemoryError( "bit {0} already assigned to '{1}'".format( io._bitaddress, oldio._name @@ -311,7 +312,8 @@ class IOBase(object): # Bitadressen auf Bytes aufbrechen und umrechnen self._bitaddress = -1 if valuelist[7] == "" else int(valuelist[7]) % 8 - self._bitshift = None if self._bitaddress == -1 else 1 << self._bitaddress + self._bitshift = None if self._bitaddress == -1 \ + else 1 << self._bitaddress # Längenberechnung self._bitlength = int(valuelist[2]) diff --git a/src/revpimodio2/modio.py b/src/revpimodio2/modio.py index e179e87..882f093 100644 --- a/src/revpimodio2/modio.py +++ b/src/revpimodio2/modio.py @@ -69,7 +69,8 @@ class RevPiModIO(object): :param simulator: Laedt das Modul als Simulator und vertauscht IOs :param debug: Gibt alle Warnungen inkl. Zyklusprobleme aus :param replace_io_file: Replace IO Konfiguration aus Datei laden - :param shared_procimg: Share process image with other processes (insecure for automation, little slower) + :param shared_procimg: Share process image with other processes, this + could be insecure for automation :param direct_output: Deprecated, use shared_procimg """ # Parameterprüfung @@ -290,7 +291,9 @@ class RevPiModIO(object): elif device["type"] == DeviceType.LEFT_RIGHT: # IOs pt = int(device["productType"]) - if pt == ProductType.DIO or pt == ProductType.DI or pt == ProductType.DO: + if pt == ProductType.DIO \ + or pt == ProductType.DI \ + or pt == ProductType.DO: # DIO / DI / DO dev_new = devicemodule.DioModule( self, device, simulator=self._simulator @@ -1454,7 +1457,6 @@ def run_plc( :param debug: Print all warnings and detailed error messages :param procimg: Use different process image :param configrsc: Use different piCtory configuration - :return: None or the return value of the cycle function """ rpi = RevPiModIO( diff --git a/src/revpimodio2/netio.py b/src/revpimodio2/netio.py index f079684..8f95673 100644 --- a/src/revpimodio2/netio.py +++ b/src/revpimodio2/netio.py @@ -710,11 +710,13 @@ class RevPiNetIO(_RevPiModIO): :param simulator: Laedt das Modul als Simulator und vertauscht IOs :param debug: Gibt bei allen Fehlern komplette Meldungen aus :param replace_io_file: Replace IO Konfiguration aus Datei laden - :param shared_procimg: Share process image with other processes (insecure for automation, little slower) + :param shared_procimg: Share process image with other processes, this + could be insecure for automation :param direct_output: Deprecated, use shared_procimg """ check_ip = compile( - r"^(25[0-5]|(2[0-4]|[01]?\d|)\d)(\.(25[0-5]|(2[0-4]|[01]?\d|)\d)){3}$" + r"^(25[0-5]|(2[0-4]|[01]?\d|)\d)" + r"(\.(25[0-5]|(2[0-4]|[01]?\d|)\d)){3}$" ) # Adresse verarbeiten @@ -1054,9 +1056,6 @@ def run_net_plc( :param cycletime: Cycle time in milliseconds :param replace_io_file: Load replace IO configuration from file :param debug: Print all warnings and detailed error messages - :param procimg: Use different process image - :param configrsc: Use different piCtory configuration - :return: None or the return value of the cycle function """ rpi = RevPiNetIO( diff --git a/stdeb.cfg b/stdeb.cfg deleted file mode 100644 index db4574b..0000000 --- a/stdeb.cfg +++ /dev/null @@ -1 +0,0 @@ -[DEFAULT]