hpcflow.sdk.core.object_list.DotAccessObjectList#
- class hpcflow.sdk.core.object_list.DotAccessObjectList(_objects, access_attribute, descriptor=None)#
Bases:
ObjectList
[T
],Generic
[T
]Provide dot-notation access via an access attribute for the case where the access attribute uniquely identifies a single object.
- Parameters:
Methods
Add an object to this list.
Add multiple objects to the list.
Make an instance of this class from JSON (or YAML) data.
Get an object from this list that matches the given criteria.
Get all objects in this list that match the given criteria.
Get a tuple of the unique access-attribute values of the constituent objects.
Serialize this object as a dictionary.
Serialize this object as an object structure that can be trivially converted to JSON.
- add_object(obj: T, index: int = -1, *, skip_duplicates: Literal[False] = False) int #
- add_object(obj: T, index: int = -1, *, skip_duplicates: Literal[True]) int | None
Add an object to this list.
- add_objects(objs, index=-1, *, skip_duplicates=False)#
Add multiple objects to the list.
- classmethod from_json_like(json_like, shared_data=None)#
Make an instance of this class from JSON (or YAML) data.
- Parameters:
json_like (str | Mapping[str, JSONed] | Sequence[Mapping[str, JSONed]] | None) – The data to deserialise.
shared_data (Mapping[str, ObjectList[JSONable]] | None) – Shared context data.
- Return type:
The deserialised object.
- get(access_attribute_value=None, **kwargs)#
Get an object from this list that matches the given criteria.
- Parameters:
access_attribute_value (str | None) –
- Return type:
T
- get_all(access_attribute_value=None, **kwargs)#
Get all objects in this list that match the given criteria.
- Parameters:
access_attribute_value (str | None) –
- list_attrs()#
Get a tuple of the unique access-attribute values of the constituent objects.
- to_json_like(dct=None, shared_data=None, exclude=(), path=None)#
Serialize this object as an object structure that can be trivially converted to JSON. Note that YAML can also be produced from the result of this method; it just requires a different final serialization step.