abinslib.io

I/O and serialization utilities for abinslib data structures.

Classes

JSONMixin

Mixin providing JSON serialization and deserialization methods.

Module Contents

class abinslib.io.JSONMixin[source]

Bases: abc.ABC

Mixin providing JSON serialization and deserialization methods.

abstractmethod to_dict() collections.abc.Mapping[str, Any][source]

Convert object to a dictionary.

classmethod from_dict(data_dict: Any) Self[source]
Abstractmethod:

Instantiate object from a dictionary.

to_json() str[source]

Convert object representation to a JSON string.

classmethod from_json(json_str: str) Self[source]

Instantiate object from a JSON string.

to_json_file(filename: pathlib.Path | str) None[source]

Write object representation to a JSON file.

classmethod from_json_file(filename: pathlib.Path | str) Self[source]

Read object representation from a JSON file.