DictInputOutput#

class pybrops.core.io.DictInputOutput.DictInputOutput[source]#

Bases: object

Abstract class for defining dict input/output functionality.

This abstract class defines two functions with the following purposes:

  • to_dict - export an object to a dict.

  • from_dict - load an object from a dict.

Methods

from_dict

Read an object from a dict.

to_dict

Export an object to a dict.

abstract classmethod from_dict(dic, **kwargs)[source]#

Read an object from a dict.

Parameters:
  • dic (dict) – Python dictionary from which to read.

  • kwargs (dict) – Additional keyword arguments to use for dictating importing from a dict.

Returns:

out – An object read from a dict.

Return type:

DictInputOutput

abstract to_dict(**kwargs)[source]#

Export an object to a dict.

Parameters:

kwargs (dict) – Additional keyword arguments to use for dictating export to a dict.

Returns:

out – An output Python dictionary.

Return type:

dict