mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-29 12:10:01 +02:00
dont make descriptors attributes of the instance -> would loose functionality
This commit is contained in:
parent
456090fee9
commit
ed7f3d8509
@ -6,7 +6,7 @@ from pydase.observer_pattern.observable.decorators import (
|
|||||||
has_validate_set_decorator,
|
has_validate_set_decorator,
|
||||||
)
|
)
|
||||||
from pydase.observer_pattern.observable.observable_object import ObservableObject
|
from pydase.observer_pattern.observable.observable_object import ObservableObject
|
||||||
from pydase.utils.helpers import is_property_attribute
|
from pydase.utils.helpers import is_descriptor, is_property_attribute
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -24,6 +24,11 @@ class Observable(ObservableObject):
|
|||||||
for name, value in class_attrs.items():
|
for name, value in class_attrs.items():
|
||||||
if isinstance(value, property) or callable(value):
|
if isinstance(value, property) or callable(value):
|
||||||
continue
|
continue
|
||||||
|
elif 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)
|
||||||
|
continue
|
||||||
self.__dict__[name] = self._initialise_new_objects(name, value)
|
self.__dict__[name] = self._initialise_new_objects(name, value)
|
||||||
|
|
||||||
def __setattr__(self, name: str, value: Any) -> None:
|
def __setattr__(self, name: str, value: Any) -> None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user