hpcflow.sdk.core.json_like.BaseJSONLike#

class hpcflow.sdk.core.json_like.BaseJSONLike#

Bases: object

An object that has a serialization as JSON or YAML.

Parameters:
  • _class_namespace (namespace) – Namespace whose attributes include the class definitions that might be referenced (and so require instantiation) in child objects.

  • _shared_data_namespace (namespace) – Namespace whose attributes include the shared data that might be referenced in child objects.

Methods

from_json_like

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

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.

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

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

Parameters:
  • json_like – The data to deserialise.

  • shared_data – Shared context data.

Return type:

The deserialised object.

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]