hpcflow.sdk.core.object_list.AppDataList#

class hpcflow.sdk.core.object_list.AppDataList(_objects, access_attribute, descriptor=None)#

Bases: DotAccessObjectList[T], Generic[T]

An application-aware object list.

Type Parameters#

T

The type of elements of the list.

Methods

add_object

Add an object to this list.

add_objects

Add multiple objects to the list.

from_json_like

Make an instance of this class from JSON (or YAML) data.

get

Get an object from this list that matches the given criteria.

get_all

Get all objects in this list that match the given criteria.

list_attrs

Get a tuple of the unique access-attribute values of the constituent objects.

to_dict

Serialize this object as a dictionary.

to_json_like

Serialize this object as an object structure that can be trivially converted to JSON.

add_object(obj, index=-1, *, skip_duplicates=False)#

Add an object to this list.

Parameters:
  • obj (T) –

  • index (int) –

  • skip_duplicates (bool) –

Return type:

int | None

add_objects(objs, index=-1, *, skip_duplicates=False)#

Add multiple objects to the list.

Parameters:
  • objs (Iterable[T]) –

  • index (int) –

  • skip_duplicates (bool) –

Return type:

int

classmethod from_json_like(json_like: str, shared_data: Mapping[str, ObjectList[JSONable]] | None = None, is_hashed: bool = False) Self | None#
classmethod from_json_like(json_like: Mapping[str, JSONed] | Sequence[Mapping[str, JSONed]], shared_data: Mapping[str, ObjectList[JSONable]] | None = None, is_hashed: bool = False) Self
classmethod from_json_like(json_like: None, shared_data: Mapping[str, ObjectList[JSONable]] | None = None, is_hashed: bool = False) None

Make an instance of this class from JSON (or YAML) data.

Parameters:
  • json_like – The data to deserialise.

  • shared_data – Shared context data.

  • is_hashed – If True, accept a dict whose keys are hashes of the dict values.

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.

Return type:

tuple[str, …]

to_dict()#

Serialize this object as a dictionary.

Return type:

dict[str, Any]

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.

Parameters:
  • dct (dict[str, JSONable] | None) –

  • shared_data (_JSONDeserState) –

  • exclude (Container[str | None]) –

  • path (list | None) –

Return type:

tuple[JSONDocument, _JSONDeserState]

Parameters:
  • _objects (Iterable[T]) –

  • access_attribute (str) –

  • descriptor (str | None) –