mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 00:40:01 +02:00
removes warning if setting private attributes (should work now)
This commit is contained in:
parent
534ff4c149
commit
3d2de7109b
@ -67,9 +67,6 @@ class DataService(rpyc.Service, AbstractDataService):
|
|||||||
# Check and warn for unexpected type changes in attributes
|
# Check and warn for unexpected type changes in attributes
|
||||||
self._warn_on_type_change(__name, __value)
|
self._warn_on_type_change(__name, __value)
|
||||||
|
|
||||||
# Warn if setting private attributes
|
|
||||||
self._warn_on_private_attr_set(__name)
|
|
||||||
|
|
||||||
# every class defined by the user should inherit from DataService if it is
|
# every class defined by the user should inherit from DataService if it is
|
||||||
# assigned to a public attribute
|
# assigned to a public attribute
|
||||||
if not __name.startswith("_"):
|
if not __name.startswith("_"):
|
||||||
@ -103,15 +100,6 @@ class DataService(rpyc.Service, AbstractDataService):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
def _warn_on_private_attr_set(self, attr_name: str) -> None:
|
|
||||||
if attr_name.startswith(f"_{self.__class__.__name__}__"):
|
|
||||||
logger.warning(
|
|
||||||
"Warning: You should not set private but rather protected attributes! "
|
|
||||||
"Use %s instead of %s.",
|
|
||||||
attr_name.replace(f"_{self.__class__.__name__}__", "_"),
|
|
||||||
attr_name.replace(f"_{self.__class__.__name__}__", "__"),
|
|
||||||
)
|
|
||||||
|
|
||||||
def __check_instance_classes(self) -> None:
|
def __check_instance_classes(self) -> None:
|
||||||
for attr_name, attr_value in get_class_and_instance_attributes(self).items():
|
for attr_name, attr_value in get_class_and_instance_attributes(self).items():
|
||||||
# every class defined by the user should inherit from DataService if it is
|
# every class defined by the user should inherit from DataService if it is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user