replaces some code with helper function

This commit is contained in:
Mose Müller 2024-08-05 16:40:59 +02:00
parent 5f78771f66
commit e69ef376ae

View File

@ -15,6 +15,7 @@ from pydase.utils.helpers import (
get_attribute_doc, get_attribute_doc,
get_component_classes, get_component_classes,
get_data_service_class_reference, get_data_service_class_reference,
is_property_attribute,
parse_full_access_path, parse_full_access_path,
parse_serialized_key, parse_serialized_key,
) )
@ -316,7 +317,7 @@ class Serializer:
value[key] = serialized_object value[key] = serialized_object
# If the DataService attribute is a property # If the DataService attribute is a property
if isinstance(getattr(obj.__class__, key, None), property): if is_property_attribute(obj, key):
prop: property = getattr(obj.__class__, key) prop: property = getattr(obj.__class__, key)
value[key]["readonly"] = prop.fset is None value[key]["readonly"] = prop.fset is None
value[key]["doc"] = get_attribute_doc(prop) # overwrite the doc value[key]["doc"] = get_attribute_doc(prop) # overwrite the doc