From e491ac745814f422dabdcf2a70c65bee389229fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mose=20M=C3=BCller?= Date: Mon, 23 Sep 2024 09:22:28 +0200 Subject: [PATCH] observable does not have to initialise descriptor objects anymore The task decorator is not returning a Task object directly anymore, but rather a descriptor which is returning the task. This is where the task is initialised and this does not have to be done in the observable base class, any more. --- src/pydase/observer_pattern/observable/observable.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pydase/observer_pattern/observable/observable.py b/src/pydase/observer_pattern/observable/observable.py index 9299fb3..b368179 100644 --- a/src/pydase/observer_pattern/observable/observable.py +++ b/src/pydase/observer_pattern/observable/observable.py @@ -22,12 +22,9 @@ class Observable(ObservableObject): - {"__annotations__"} } for name, value in class_attrs.items(): - if isinstance(value, property) or callable(value): - continue - if is_descriptor(value): - # Descriptors have to be stored as a class variable in another class to - # work properly. So don't make it an instance attribute. - self._initialise_new_objects(name, value) + if isinstance(value, property) or callable(value) or is_descriptor(value): + # Properties, methods and descriptors have to be stored as class + # attributes to work properly. So don't make it an instance attribute. continue self.__dict__[name] = self._initialise_new_objects(name, value)