Code and project cleanup

This commit is contained in:
2023-01-20 17:08:35 +01:00
parent 1b7397e608
commit 05e4ff96ca
7 changed files with 17 additions and 14 deletions

2
.gitignore vendored
View File

@@ -114,5 +114,5 @@ dmypy.json
# Pyre type checker # Pyre type checker
.pyre/ .pyre/
/test/
/make.conf /make.conf
/test_local/

View File

@@ -1,5 +1,6 @@
recursive-include src/revpimodio *.py
include LICENSE.txt include LICENSE.txt
include Makefile
include MANIFEST.in include MANIFEST.in
include README.md include README.md
include requirements.txt
include setup.py include setup.py

View File

@@ -1,2 +1,2 @@
setuptools>=65.6.3 setuptools>=58.0.4
wheel wheel

View File

@@ -176,7 +176,8 @@ class IOList(object):
if type(oldio) == StructIO: if type(oldio) == StructIO:
# Hier gibt es schon einen neuen IO # Hier gibt es schon einen neuen IO
if oldio._bitshift: 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( raise MemoryError(
"bit {0} already assigned to '{1}'".format( "bit {0} already assigned to '{1}'".format(
io._bitaddress, oldio._name io._bitaddress, oldio._name
@@ -311,7 +312,8 @@ class IOBase(object):
# Bitadressen auf Bytes aufbrechen und umrechnen # Bitadressen auf Bytes aufbrechen und umrechnen
self._bitaddress = -1 if valuelist[7] == "" else int(valuelist[7]) % 8 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 # Längenberechnung
self._bitlength = int(valuelist[2]) self._bitlength = int(valuelist[2])

View File

@@ -69,7 +69,8 @@ class RevPiModIO(object):
:param simulator: Laedt das Modul als Simulator und vertauscht IOs :param simulator: Laedt das Modul als Simulator und vertauscht IOs
:param debug: Gibt alle Warnungen inkl. Zyklusprobleme aus :param debug: Gibt alle Warnungen inkl. Zyklusprobleme aus
:param replace_io_file: Replace IO Konfiguration aus Datei laden :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 :param direct_output: Deprecated, use shared_procimg
""" """
# Parameterprüfung # Parameterprüfung
@@ -290,7 +291,9 @@ class RevPiModIO(object):
elif device["type"] == DeviceType.LEFT_RIGHT: elif device["type"] == DeviceType.LEFT_RIGHT:
# IOs # IOs
pt = int(device["productType"]) 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 # DIO / DI / DO
dev_new = devicemodule.DioModule( dev_new = devicemodule.DioModule(
self, device, simulator=self._simulator self, device, simulator=self._simulator
@@ -1454,7 +1457,6 @@ def run_plc(
:param debug: Print all warnings and detailed error messages :param debug: Print all warnings and detailed error messages
:param procimg: Use different process image :param procimg: Use different process image
:param configrsc: Use different piCtory configuration :param configrsc: Use different piCtory configuration
:return: None or the return value of the cycle function :return: None or the return value of the cycle function
""" """
rpi = RevPiModIO( rpi = RevPiModIO(

View File

@@ -710,11 +710,13 @@ class RevPiNetIO(_RevPiModIO):
:param simulator: Laedt das Modul als Simulator und vertauscht IOs :param simulator: Laedt das Modul als Simulator und vertauscht IOs
:param debug: Gibt bei allen Fehlern komplette Meldungen aus :param debug: Gibt bei allen Fehlern komplette Meldungen aus
:param replace_io_file: Replace IO Konfiguration aus Datei laden :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 :param direct_output: Deprecated, use shared_procimg
""" """
check_ip = compile( 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 # Adresse verarbeiten
@@ -1054,9 +1056,6 @@ def run_net_plc(
:param cycletime: Cycle time in milliseconds :param cycletime: Cycle time in milliseconds
:param replace_io_file: Load replace IO configuration from file :param replace_io_file: Load replace IO configuration from file
:param debug: Print all warnings and detailed error messages :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 :return: None or the return value of the cycle function
""" """
rpi = RevPiNetIO( rpi = RevPiNetIO(

View File

@@ -1 +0,0 @@
[DEFAULT]