mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-21 00:40:01 +02:00
DataService: updating serialize
- removing unnecessary prefix - updating list serialization
This commit is contained in:
parent
49d7ea30ef
commit
3352d34ec6
@ -401,7 +401,7 @@ class DataService(rpyc.Service, TaskManager):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
|
|
||||||
def serialize(self, prefix: str = "") -> dict[str, dict[str, Any]]: # noqa
|
def serialize(self) -> dict[str, dict[str, Any]]: # noqa
|
||||||
"""
|
"""
|
||||||
Serializes the instance into a dictionary, preserving the structure of the
|
Serializes the instance into a dictionary, preserving the structure of the
|
||||||
instance.
|
instance.
|
||||||
@ -463,9 +463,6 @@ class DataService(rpyc.Service, TaskManager):
|
|||||||
# Get the value of the current attribute or method
|
# Get the value of the current attribute or method
|
||||||
value = getattr(self, key)
|
value = getattr(self, key)
|
||||||
|
|
||||||
# Prepare the key by appending prefix and the key
|
|
||||||
key = f"{prefix}.{key}" if prefix else key
|
|
||||||
|
|
||||||
if isinstance(value, DataService):
|
if isinstance(value, DataService):
|
||||||
result[key] = {
|
result[key] = {
|
||||||
"type": type(value).__name__
|
"type": type(value).__name__
|
||||||
@ -480,8 +477,11 @@ class DataService(rpyc.Service, TaskManager):
|
|||||||
"type": "list",
|
"type": "list",
|
||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"type": type(item).__name__,
|
"type": "DataService"
|
||||||
"value": item.serialize(prefix=key)
|
if isinstance(item, DataService)
|
||||||
|
and type(item).__name__ not in ("NumberSlider")
|
||||||
|
else type(item).__name__,
|
||||||
|
"value": item.serialize()
|
||||||
if isinstance(item, DataService)
|
if isinstance(item, DataService)
|
||||||
else item,
|
else item,
|
||||||
"readonly": False,
|
"readonly": False,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user