mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-09 06:13:53 +01:00
Fehlerverwaltung bei cycleloop und mainloop
Device.__contains__ Rückgabe bei ersetzen IOs nun False RevPiModIO.__del__ löst klarere Fehler bei falscher Instantiierung aus
This commit is contained in:
@@ -171,18 +171,20 @@ class Device(object):
|
||||
def __contains__(self, key):
|
||||
"""Prueft ob IO auf diesem Device liegt.
|
||||
@param key IO-Name <class 'str'> / IO-Bytenummer <class 'int'>
|
||||
@return True, wenn device vorhanden"""
|
||||
if type(key) == str:
|
||||
return key in self._modio.io \
|
||||
and getattr(self._modio.io, key)._parentdevice == self
|
||||
elif type(key) == int:
|
||||
@return True, wenn IO auf Device vorhanden"""
|
||||
if issubclass(type(key), IOBase):
|
||||
# Umwandlung für key
|
||||
key = key._name
|
||||
|
||||
if type(key) == int:
|
||||
if key in self._modio.io:
|
||||
for io in self._modio.io[key]:
|
||||
if io is not None and io._parentdevice == self:
|
||||
return True
|
||||
return False
|
||||
else:
|
||||
return key._parentdevice == self
|
||||
return key in self._modio.io \
|
||||
and getattr(self._modio.io, key)._parentdevice == self
|
||||
|
||||
def __int__(self):
|
||||
"""Gibt die Positon im RevPi Bus zurueck.
|
||||
|
||||
Reference in New Issue
Block a user