module adabmDCA.serialization
Portable and atomic serialization helpers for results, logs and archives.
Global Variables
- RESULT_SCHEMA_VERSION
function to_jsonable
to_jsonable(value: 'Any') → Any
Recursively convert a value to plain JSON types.
NumPy scalars and arrays, tensors, paths, dataclasses, mappings and sequences are converted; non-finite floats become None.
Args:
value: Value to convert.
Returns:
A structure of dict, list, str, int, float, bool and None only.
function result_document
result_document(result_type: 'str', data: 'Mapping[str, Any]') → dict[str, Any]
Wrap result data in a stable, versioned document envelope.
function write_json
write_json(
path: 'str | Path',
payload: 'Mapping[str, Any]',
indent: 'int' = 2
) → Path
Write strict UTF-8 JSON atomically.
function write_dataframe
write_dataframe(path: 'str | Path', dataframe: 'Any', **kwargs: 'Any') → Path
Write a pandas-compatible dataframe atomically.
function write_text
write_text(path: 'str | Path', content: 'str') → Path
Write UTF-8 text atomically.
function write_numpy
write_numpy(path: 'str | Path', array: 'ndarray') → Path
Write a NumPy array atomically without altering the requested suffix.
function write_numpy_text
write_numpy_text(path: 'str | Path', array: 'ndarray', **kwargs: 'Any') → Path
Write a NumPy array as an atomic text artifact.
function resolve_format
resolve_format(
path: 'str | Path',
format: 'str | None',
supported: 'set[str]'
) → str
Resolve an explicit format or infer it from a filename suffix.
This file was automatically generated via lazydocs.