add eq, comp, gate to apply examples.

This commit is contained in:
2023-06-24 19:06:23 +01:00
parent 2f9864cf60
commit cc26720ae2
4 changed files with 14 additions and 11 deletions

View File

@@ -45,9 +45,11 @@ class IRemote(metaclass=ABCMeta):
for attr, val in data.items():
if not isinstance(val, dict):
if hasattr(self, attr):
if attr in dir(self): # avoid calling getattr (with hasattr)
target, attr, val = fget(attr, val)
setattr(target, attr, val)
else:
self.logger.error(f"invalid attribute {attr} for {self}")
else:
target = getattr(self, attr)
target.apply(val)