paraqeet.serialization.serializer.Serializer#

class paraqeet.serialization.serializer.Serializer#

Bases: ABC

Interface for any class that can read and write configurations to a persistent format, e.g. a file. This can be used for the state of an optimization or the setup of the layers.

__init__()#

Methods

__init__()

load()

Loads and returns data that was previously saved.

load_comment()

Loads and returns the comment, if any, that was previously saved with the data.

save(data[, comment])

Saves data to a persistent format.

abstract load()#

Loads and returns data that was previously saved.

Return type:

dict

abstract load_comment()#

Loads and returns the comment, if any, that was previously saved with the data. Returns None if no comment was saved.

Returns

The comment, or None if no comment was saved.

Return type:

str | None

abstract save(data, comment=None)#

Saves data to a persistent format. The actual format depends on the implementation.

Parameters:
  • data (dict) – the data to be exported

  • comment (str) – Optional comment to be stored with the data, for example a description of the data. Implementations have to decide how to store the comment.

  • -------

Return type:

None