ersilia.tools.bentoml.utils package

Submodules

ersilia.tools.bentoml.utils.dataclasses module

class ersilia.tools.bentoml.utils.dataclasses.DataclassJsonEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: JSONEncoder

Special JSON encoder for dataclass types.

default(o)[source]

Override the default method to handle dataclass objects.

default(o)[source]

Override the default method to handle dataclass objects.

Parameters:

o (object) – The object to encode.

Returns:

The encoded object as a dictionary.

Return type:

dict

class ersilia.tools.bentoml.utils.dataclasses.json_serializer(fields=None, compat=False)[source]

Bases: object

A decorator for serializing dataclass objects to JSON.

Parameters:
  • fields (list, optional) – The fields to include in the JSON output (default is None, which includes all fields).

  • compat (bool, optional) – If True, only include fields that have non-default values (default is False).

__call__(klass)[source]

Apply the decorator to the dataclass.

Module contents