Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
+Webpage: https://revpimodio.org/
+
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
diff --git a/doc/revpimodio2.__init__.html b/doc/revpimodio2.__init__.html
index 7b11ad7..2bb8f2b 100644
--- a/doc/revpimodio2.__init__.html
+++ b/doc/revpimodio2.__init__.html
@@ -9,6 +9,8 @@ revpimodio2.__init__
Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
+Webpage: https://revpimodio.org/
+
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
@@ -20,7 +22,7 @@ fuehrt das Modul bei Datenaenderung aus.
Global Attributes
-
BOTH
FALLING
GREEN
INP
MEM
OFF
OUT
RED
RISING
__all__
__author__
__name__
__package__
__version__
+
BOTH
FALLING
GREEN
INP
MEM
OFF
OUT
RED
RISING
__all__
__author__
__copyright__
__license__
__name__
__version__
Classes
diff --git a/doc/revpimodio2.app.html b/doc/revpimodio2.app.html
index c18e732..e6a1b6e 100644
--- a/doc/revpimodio2.app.html
+++ b/doc/revpimodio2.app.html
@@ -12,7 +12,7 @@ Bildet die App Sektion von piCtory ab.
Global Attributes
-
None
+
__author__
__copyright__
__license__
Classes
diff --git a/doc/revpimodio2.device.html b/doc/revpimodio2.device.html
index 09fa806..f3894a6 100644
--- a/doc/revpimodio2.device.html
+++ b/doc/revpimodio2.device.html
@@ -12,7 +12,7 @@ Modul fuer die Verwaltung der Devices.
Global Attributes
-
None
+
__author__
__copyright__
__license__
Classes
diff --git a/doc/revpimodio2.helper.html b/doc/revpimodio2.helper.html
index 3ece18f..ee90dfb 100644
--- a/doc/revpimodio2.helper.html
+++ b/doc/revpimodio2.helper.html
@@ -12,7 +12,7 @@ RevPiModIO Helperklassen und Tools.
Global Attributes
-
None
+
__author__
__copyright__
__license__
Classes
diff --git a/doc/revpimodio2.io.html b/doc/revpimodio2.io.html
index df89bfc..19eb3b7 100644
--- a/doc/revpimodio2.io.html
+++ b/doc/revpimodio2.io.html
@@ -12,7 +12,7 @@ RevPiModIO Modul fuer die Verwaltung der IOs.
diff --git a/doc/revpimodio2.summary.html b/doc/revpimodio2.summary.html
index 2741c25..194214e 100644
--- a/doc/revpimodio2.summary.html
+++ b/doc/revpimodio2.summary.html
@@ -12,7 +12,7 @@ Bildet die Summary-Sektion von piCtory ab.
Global Attributes
-
None
+
__author__
__copyright__
__license__
Classes
diff --git a/revpimodio2.e4p b/revpimodio2.e4p
index 11a437a..4223e53 100644
--- a/revpimodio2.e4p
+++ b/revpimodio2.e4p
@@ -1,7 +1,7 @@
-
+
en_US
@@ -14,40 +14,40 @@
akira@narux.de
- setup.py
- revpimodio2/modio.py
- revpimodio2/summary.py
- revpimodio2/app.py
- revpimodio2/io.pyrevpimodio2/__init__.py
+ revpimodio2/app.pyrevpimodio2/device.pyrevpimodio2/helper.py
+ revpimodio2/io.py
+ revpimodio2/modio.pyrevpimodio2/netio.py
- test/test_dio_while2.py
- test/test_dio_mainloop.py
+ revpimodio2/summary.py
+ setup.pytest/test_dio_cycleloop.py
+ test/test_dio_mainloop.py
+ test/test_dio_while2.pytest/test_net_leistung.py
- test/web_cycleloop.py
- test/web_mainloop.py
- test/web_virtdevdriver.py
+ test/test_netio_brett.py
+ test/test_unit.py
+ test/test_unit_fh.py
+ test/test_unitnet.pytest/web_benniesrun.pytest/web_benniesrunxxl.py
- test/test_unit.py
- test/test_unitnet.py
- test/test_netio_brett.py
- test/web_startseite.py
+ test/web_cycleloop.py
+ test/web_mainloop.pytest/web_rpidaten.pytest/web_rpii2c.py
- test/test_unit_fh.py
+ test/web_startseite.py
+ test/web_virtdevdriver.py
- doc.hgignoreMANIFEST.in
+ doceric-revpimodio2.apitest/test_unit.py
@@ -153,9 +153,6 @@
-
-
-
@@ -249,14 +246,6 @@
False
-
- sourceExtensions
-
-
-
-
-
- useRecursion
@@ -276,6 +265,41 @@
+
+ BuiltinsChecker
+
+
+
+
+ chr
+
+
+
+ unichr
+
+
+
+ str
+
+
+
+ unicode
+
+
+
+
+
+ CopyrightAuthor
+
+
+
+
+
+ CopyrightMinFileSize
+
+
+ 0
+ DocstringType
@@ -286,13 +310,13 @@
ExcludeFiles
-
+ */test/*ExcludeMessages
- E123,E226,E24
+ E123,E226,E24,C101,E402,C111FixCodes
@@ -306,6 +330,12 @@
False
+
+ FutureChecker
+
+
+
+ HangClosing
@@ -318,6 +348,24 @@
+
+ LineComplexity
+
+
+ 15
+
+
+ LineComplexityScore
+
+
+ 10
+
+
+ MaxCodeComplexity
+
+
+ 10
+ MaxLineLength
@@ -342,6 +390,12 @@
False
+
+ ValidEncodings
+
+
+ latin-1, utf-8
+
diff --git a/revpimodio2/__init__.py b/revpimodio2/__init__.py
index ae8ffae..ce1eff2 100644
--- a/revpimodio2/__init__.py
+++ b/revpimodio2/__init__.py
@@ -1,12 +1,8 @@
# -*- coding: utf-8 -*-
-#
-# python3-RevPiModIO
-#
-# Webpage: https://revpimodio.org/
-# (c) Sven Sager, License: LGPLv3
-#
"""Stellt alle Klassen fuer den RevolutionPi zur Verfuegung.
+Webpage: https://revpimodio.org/
+
Stellt Klassen fuer die einfache Verwendung des Revolution Pis der
Kunbus GmbH (https://revolution.kunbus.de/) zur Verfuegung. Alle I/Os werden
aus der piCtory Konfiguration eingelesen und mit deren Namen direkt zugreifbar
@@ -23,8 +19,9 @@ __all__ = [
"RevPiNetIO", "RevPiNetIOSelected", "RevPiNetIODriver"
]
__author__ = "Sven Sager "
+__copyright__ = "Copyright (C) 2018 Sven Sager"
+__license__ = "LGPLv3"
__name__ = "revpimodio2"
-__package__ = "revpimodio2"
__version__ = "2.2.2"
# Global package values
@@ -71,6 +68,7 @@ def consttostr(value):
else:
return ""
+
# Benötigte Klassen importieren
from .modio import RevPiModIO, RevPiModIOSelected, RevPiModIODriver
from .netio import RevPiNetIO, RevPiNetIOSelected, RevPiNetIODriver
diff --git a/revpimodio2/app.py b/revpimodio2/app.py
index 03d6c1e..010c437 100644
--- a/revpimodio2/app.py
+++ b/revpimodio2/app.py
@@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
-#
-# python3-RevPiModIO
-#
-# Webpage: https://revpimodio.org/
-# (c) Sven Sager, License: LGPLv3
-#
"""Bildet die App Sektion von piCtory ab."""
+__author__ = "Sven Sager"
+__copyright__ = "Copyright (C) 2018 Sven Sager"
+__license__ = "LGPLv3"
class App(object):
diff --git a/revpimodio2/device.py b/revpimodio2/device.py
index 7e60641..7754ecc 100644
--- a/revpimodio2/device.py
+++ b/revpimodio2/device.py
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
-#
-# python3-RevPiModIO
-#
-# Webpage: https://revpimodio.org/
-# (c) Sven Sager, License: LGPLv3
-#
"""Modul fuer die Verwaltung der Devices."""
+__author__ = "Sven Sager"
+__copyright__ = "Copyright (C) 2018 Sven Sager"
+__license__ = "LGPLv3"
+
from threading import Thread, Event, Lock
from .helper import ProcimgWriter
@@ -65,7 +63,7 @@ class DeviceList(object):
@return Gefundenes -Objekt"""
if type(key) == int:
if key not in self.__dict_position:
- raise KeyError("no device on position {}".format(key))
+ raise KeyError("no device on position {0}".format(key))
return self.__dict_position[key]
else:
return getattr(self, key)
diff --git a/revpimodio2/helper.py b/revpimodio2/helper.py
index 7d6557a..b79c2df 100644
--- a/revpimodio2/helper.py
+++ b/revpimodio2/helper.py
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
-#
-# python3-RevPiModIO
-#
-# Webpage: https://revpimodio.org/
-# (c) Sven Sager, License: LGPLv3
-#
"""RevPiModIO Helperklassen und Tools."""
+__author__ = "Sven Sager"
+__copyright__ = "Copyright (C) 2018 Sven Sager"
+__license__ = "LGPLv3"
+
import queue
import warnings
from math import ceil
@@ -413,12 +411,12 @@ class ProcimgWriter(Thread):
self._ioerror += 1
if self._maxioerrors != 0 and self._ioerror >= self._maxioerrors:
raise RuntimeError(
- "reach max io error count {} on process image".format(
+ "reach max io error count {0} on process image".format(
self._maxioerrors
)
)
warnings.warn(
- "count {} io errors on process image".format(self._ioerror),
+ "count {0} io errors on process image".format(self._ioerror),
RuntimeWarning
)
@@ -443,7 +441,7 @@ class ProcimgWriter(Thread):
# Lockobjekt holen und Fehler werfen, wenn nicht schnell genug
if not self.lck_refresh.acquire(timeout=self._adjwait):
warnings.warn(
- "cycle time of {} ms exceeded on lock".format(
+ "cycle time of {0} ms exceeded on lock".format(
int(self._refresh * 1000)
),
RuntimeWarning
@@ -496,8 +494,8 @@ class ProcimgWriter(Thread):
# Verzögerte Events prüfen
if self.__eventwork:
for tup_fire in list(self.__dict_delay.keys()):
- if tup_fire[0].overwrite \
- and getattr(self._modio.io, tup_fire[1]).value != \
+ if tup_fire[0].overwrite and \
+ getattr(self._modio.io, tup_fire[1]).value != \
tup_fire[2]:
del self.__dict_delay[tup_fire]
else:
@@ -518,7 +516,7 @@ class ProcimgWriter(Thread):
self._adjwait -= 0.001
if self._adjwait < 0:
warnings.warn(
- "cycle time of {} ms exceeded".format(
+ "cycle time of {0} ms exceeded".format(
int(self._refresh * 1000)
),
RuntimeWarning
diff --git a/revpimodio2/io.py b/revpimodio2/io.py
index 3568f10..839efe3 100644
--- a/revpimodio2/io.py
+++ b/revpimodio2/io.py
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
-#
-# python3-RevPiModIO
-#
-# Webpage: https://revpimodio.org/
-# (c) Sven Sager, License: LGPLv3
-#
"""RevPiModIO Modul fuer die Verwaltung der IOs."""
+__author__ = "Sven Sager"
+__copyright__ = "Copyright (C) 2018 Sven Sager"
+__license__ = "LGPLv3"
+
import struct
from re import match as rematch
from threading import Event
@@ -69,7 +67,7 @@ class IOList(object):
if key in self.__dict_iorefname:
return self.__dict_iorefname[key]
else:
- raise AttributeError("can not find io '{}'".format(key))
+ raise AttributeError("can not find io '{0}'".format(key))
def __getitem__(self, key):
"""Ruft angegebenen IO ab.
@@ -86,7 +84,7 @@ class IOList(object):
"""
if type(key) == int:
if key not in self.__dict_iobyte:
- raise KeyError("byte '{}' does not exist".format(key))
+ raise KeyError("byte '{0}' does not exist".format(key))
return self.__dict_iobyte[key]
elif type(key) == slice:
return [
@@ -151,14 +149,14 @@ class IOList(object):
if oldio._bitaddress >= 0:
if io._bitaddress == oldio._bitaddress:
raise MemoryError(
- "bit {} already assigned to '{}'".format(
+ "bit {0} already assigned to '{1}'".format(
io._bitaddress, oldio._name
)
)
else:
# Bereits überschriebene bytes sind ungültig
raise MemoryError(
- "new io '{}' overlaps memory of '{}'".format(
+ "new io '{0}' overlaps memory of '{1}'".format(
io._name, oldio._name
)
)
@@ -194,7 +192,7 @@ class IOList(object):
if isinstance(new_io, IOBase):
if hasattr(self, new_io._name):
raise AttributeError(
- "attribute {} already exists - can not set io".format(
+ "attribute {0} already exists - can not set io".format(
new_io._name
)
)
@@ -298,7 +296,7 @@ class IOBase(object):
else:
raise ValueError(
"given bytes for default value must have a length "
- "of {} but {} was given"
+ "of {0} but {1} was given"
"".format(self._length, len(valuelist[1]))
)
else:
@@ -312,7 +310,7 @@ class IOBase(object):
if len(buff) <= self._length:
self._defaultvalue = \
buff + bytes(self._length - len(buff))
- except:
+ except Exception:
pass
else:
@@ -328,7 +326,7 @@ class IOBase(object):
else:
try:
self._defaultvalue = bool(int(valuelist[1]))
- except:
+ except Exception:
self._defaultvalue = False
def __bool__(self):
@@ -367,7 +365,7 @@ class IOBase(object):
# Prüfen ob Funktion callable ist
if not callable(func):
raise AttributeError(
- "registered function '{}' is not callable".format(func)
+ "registered function '{0}' is not callable".format(func)
)
if type(delay) != int or delay < 0:
raise AttributeError(
@@ -391,20 +389,21 @@ class IOBase(object):
if edge == BOTH or regfunc.edge == BOTH:
if self._bitaddress < 0:
raise AttributeError(
- "io '{}' with function '{}' already in list."
+ "io '{0}' with function '{1}' already in list."
"".format(self._name, func)
)
else:
raise AttributeError(
- "io '{}' with function '{}' already in list with "
- "edge '{}' - edge '{}' not allowed anymore".format(
+ "io '{0}' with function '{1}' already in list "
+ "with edge '{2}' - edge '{3}' not allowed anymore"
+ "".format(
self._name, func,
consttostr(regfunc.edge), consttostr(edge)
)
)
elif regfunc.edge == edge:
raise AttributeError(
- "io '{}' with function '{}' for given edge '{}' "
+ "io '{0}' with function '{1}' for given edge '{2}' "
"already in list".format(
self._name, func, consttostr(edge)
)
@@ -584,31 +583,31 @@ class IOBase(object):
value
else:
raise ValueError(
- "'{}' requires a object of length "
- "{}, but {} was given".format(
+ "'{0}' requires a object of "
+ "length {1}, but {2} was given".format(
self._name, self._length, len(value)
)
)
else:
raise ValueError(
- "'{}' requires a object, not {}"
+ "'{0}' requires a object, not {1}"
"".format(self._name, type(value))
)
elif self._iotype == INP:
if self._parentdevice._modio._simulator:
raise AttributeError(
- "can not write to output '{}' in simulator mode"
+ "can not write to output '{0}' in simulator mode"
"".format(self._name)
)
else:
raise AttributeError(
- "can not write to input '{}'".format(self._name)
+ "can not write to input '{0}'".format(self._name)
)
elif self._iotype == MEM:
raise AttributeError(
- "can not write to memory '{}'".format(self._name)
+ "can not write to memory '{0}'".format(self._name)
)
def unreg_event(self, func=None, edge=None):
@@ -679,7 +678,7 @@ class IOBase(object):
# Prüfen ob Device in autorefresh ist
if not self._parentdevice._selfupdate:
raise RuntimeError(
- "autorefresh is not activated for device '{}|{}' - there "
+ "autorefresh is not activated for device '{0}|{1}' - there "
"will never be new data".format(
self._parentdevice._position, self._parentdevice._name
)
@@ -825,7 +824,7 @@ class IntIO(IOBase):
))
else:
raise ValueError(
- "'{}' need a value, but {} was given"
+ "'{0}' need a value, but {1} was given"
"".format(self._name, type(value))
)
@@ -873,7 +872,7 @@ class StructIO(IOBase):
max_bits = parentio._length * 8
if not (0 <= bitaddress < max_bits):
raise AttributeError(
- "bitaddress must be a value between 0 and {}"
+ "bitaddress must be a value between 0 and {0}"
"".format(max_bits - 1)
)
bitlength = 1
diff --git a/revpimodio2/modio.py b/revpimodio2/modio.py
index 4501c88..737ac5b 100644
--- a/revpimodio2/modio.py
+++ b/revpimodio2/modio.py
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
-#
-# python3-RevPiModIO
-#
-# Webpage: https://revpimodio.org/
-# (c) Sven Sager, License: LGPLv3
-#
"""RevPiModIO Hauptklasse fuer piControl0 Zugriff."""
+__author__ = "Sven Sager"
+__copyright__ = "Copyright (C) 2018 Sven Sager"
+__license__ = "LGPLv3"
+
import warnings
from json import load as jload
from os import access, F_OK, R_OK
@@ -187,7 +185,7 @@ class RevPiModIO(object):
else:
# Device-Type nicht gefunden
warnings.warn(
- "device type '{}' unknown".format(device["type"]),
+ "device type '{0}' unknown".format(device["type"]),
Warning
)
dev_new = None
@@ -298,12 +296,12 @@ class RevPiModIO(object):
self._ioerror += 1
if self._maxioerrors != 0 and self._ioerror >= self._maxioerrors:
raise RuntimeError(
- "reach max io error count {} on process image".format(
+ "reach max io error count {0} on process image".format(
self._maxioerrors
)
)
warnings.warn(
- "got io error during {} and count {} errors now".format(
+ "got io error during {0} and count {1} errors now".format(
action, self._ioerror
),
RuntimeWarning
@@ -385,7 +383,7 @@ class RevPiModIO(object):
# Prüfen ob Funktion callable ist
if not callable(func):
raise RuntimeError(
- "registered function '{}' ist not callable".format(func)
+ "registered function '{0}' ist not callable".format(func)
)
# Zykluszeit übernehmen
@@ -478,7 +476,7 @@ class RevPiModIO(object):
if self._configrsc is not None:
if not access(self._configrsc, F_OK | R_OK):
raise RuntimeError(
- "can not access pictory configuration at {}".format(
+ "can not access pictory configuration at {0}".format(
self._configrsc))
else:
# piCtory Konfiguration an bekannten Stellen prüfen
@@ -489,7 +487,7 @@ class RevPiModIO(object):
break
if self._configrsc is None:
raise RuntimeError(
- "can not access known pictory configurations at {} - "
+ "can not access known pictory configurations at {0} - "
"use 'configrsc' parameter so specify location"
"".format(", ".join(lst_rsc))
)
@@ -497,7 +495,7 @@ class RevPiModIO(object):
with open(self._configrsc, "r") as fhconfigrsc:
try:
jdata = jload(fhconfigrsc)
- except:
+ except Exception:
raise RuntimeError(
"can not read piCtory configuration - check your hardware "
"configuration http://revpi_ip/"
@@ -529,7 +527,8 @@ class RevPiModIO(object):
# Prüfen ob Funktion callable ist
if not (cleanupfunc is None or callable(cleanupfunc)):
raise RuntimeError(
- "registered function '{}' ist not callable".format(cleanupfunc)
+ "registered function '{0}' ist not callable"
+ "".format(cleanupfunc)
)
self.__cleanupfunc = cleanupfunc
signal(SIGINT, self.__evt_exit)
@@ -628,7 +627,7 @@ class RevPiModIO(object):
if dev._selfupdate:
raise RuntimeError(
- "can not read process image, while device '{}|{}'"
+ "can not read process image, while device '{0}|{1}'"
"is in autorefresh mode".format(dev._position, dev._name)
)
mylist = [dev]
@@ -703,7 +702,7 @@ class RevPiModIO(object):
if dev._selfupdate:
raise RuntimeError(
- "can not sync outputs, while device '{}|{}'"
+ "can not sync outputs, while device '{0}|{1}'"
"is in autorefresh mode".format(dev._position, dev._name)
)
mylist = [dev]
@@ -746,7 +745,7 @@ class RevPiModIO(object):
if dev._selfupdate:
raise RuntimeError(
- "can not write process image, while device '{}|{}'"
+ "can not write process image, while device '{0}|{1}'"
"is in autorefresh mode".format(dev._position, dev._name)
)
mylist = [dev]
diff --git a/revpimodio2/netio.py b/revpimodio2/netio.py
index f2c1981..43325b9 100644
--- a/revpimodio2/netio.py
+++ b/revpimodio2/netio.py
@@ -1,11 +1,9 @@
# -*- coding: utf-8 -*-
-#
-# python3-RevPiModIO
-#
-# Webpage: https://revpimodio.org/
-# (c) Sven Sager, License: LGPLv3
-#
"""RevPiModIO Hauptklasse fuer Netzwerkzugriff."""
+__author__ = "Sven Sager"
+__copyright__ = "Copyright (C) 2018 Sven Sager"
+__license__ = "LGPLv3"
+
import socket
import warnings
from json import loads as jloads
@@ -79,7 +77,7 @@ class NetFH(Thread):
so = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
so.connect(self._address)
- except:
+ except Exception:
so.close()
else:
# Alten Socket trennen
@@ -141,7 +139,7 @@ class NetFH(Thread):
self._slavesock.send(_sysexit)
else:
self._slavesock.shutdown(socket.SHUT_RDWR)
- except:
+ except Exception:
pass
self._slavesock.close()
@@ -178,7 +176,7 @@ class NetFH(Thread):
def get_name(self):
"""Verbindugnsnamen zurueckgeben.
@return IP:PORT"""
- return "{}:{}".format(*self._address)
+ return "{0}:{1}".format(*self._address)
def get_timeout(self):
"""Gibt aktuellen Timeout zurueck.
@@ -423,7 +421,7 @@ class RevPiNetIO(_RevPiModIO):
autorefresh,
monitoring,
syncoutputs,
- "{}:{}".format(*self._address),
+ "{0}:{1}".format(*self._address),
None,
simulator
)
diff --git a/revpimodio2/summary.py b/revpimodio2/summary.py
index 0fcfb8d..9bdc72a 100644
--- a/revpimodio2/summary.py
+++ b/revpimodio2/summary.py
@@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
-#
-# python3-RevPiModIO
-#
-# Webpage: https://revpimodio.org/
-# (c) Sven Sager, License: LGPLv3
-#
"""Bildet die Summary-Sektion von piCtory ab."""
+__author__ = "Sven Sager"
+__copyright__ = "Copyright (C) 2018 Sven Sager"
+__license__ = "LGPLv3"
class Summary(object):
diff --git a/setup.py b/setup.py
index a332834..0ec5220 100644
--- a/setup.py
+++ b/setup.py
@@ -1,9 +1,10 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
-#
-# (c) Sven Sager, License: LGPLv3
-#
"""Setupscript fuer python3-revpimodio."""
+__author__ = "Sven Sager"
+__copyright__ = "Copyright (C) 2018 Sven Sager"
+__license__ = "LGPLv3"
+
from distutils.core import setup
setup(