Serialization
Source code in src/specklepy/serialization/base_object_serializer.py
write_transports
instance-attribute
write_transports: List[AbstractTransport] = (
write_transports or []
)
write_json
write_json(base: Base)
Serializes a given base object into a json string Arguments: base {Base} -- the base object to be decomposed and serialized
Returns:
| Type | Description |
|---|---|
|
(str, str) -- a tuple containing the object id of the base object and |
|
|
the serialized object string |
Source code in src/specklepy/serialization/base_object_serializer.py
traverse_base
Decomposes the given base object and builds a serializable dictionary
Returns:
| Type | Description |
|---|---|
str
|
(str, dict) -- a tuple containing the object id of the base object and |
Dict[str, Any]
|
the constructed serializable dictionary |
Source code in src/specklepy/serialization/base_object_serializer.py
traverse_value
Decomposes a given object and constructs a serializable object or dictionary
Returns:
| Type | Description |
|---|---|
Any
|
Any -- a serializable version of the given object |
Source code in src/specklepy/serialization/base_object_serializer.py
detach_helper
Helper to keep track of detached objects and their depth in the family tree and create reference objects to place in the parent object
Returns:
| Type | Description |
|---|---|
Dict[str, str]
|
dict -- a reference object to be inserted into the given object's parent |
Source code in src/specklepy/serialization/base_object_serializer.py
read_json
Recomposes a Base object from the string representation of the object
Returns:
| Type | Description |
|---|---|
Base
|
Base -- the base object with all it's children attached |
Source code in src/specklepy/serialization/base_object_serializer.py
recompose_base
Steps through a base object dictionary and recomposes the base object
Returns:
| Type | Description |
|---|---|
Base
|
Base -- the base object with all its children attached |
Source code in src/specklepy/serialization/base_object_serializer.py
handle_value
handle_value(obj: Any)
Helper for recomposing a base object by handling the dictionary representation's values
Returns:
| Type | Description |
|---|---|
|
Any -- the handled value (primitive, list, dictionary, or Base) |
Source code in src/specklepy/serialization/base_object_serializer.py
get_child
get_child(obj: Dict)