pypeec.io

Module for serialization and deserialization.
  • load JSON/YAML configuration files

  • load and write Pickle files

For YAML files, the following custom extensions are used:
  • “!path” - allow the inclusion of relative paths

  • “!include” - allow the inclusion of YAML sub-files

Warning

  • Pickling data is not secure.

  • Only load pickle files that you trust.

  • Do not commit the Pickle files in the Git repository.

pypeec.io.load_config(filename)

Load a config file (JSON or YAML).

Parameters:

filename (string)) – Name and path of the file to be loaded. The file type is determined by the extension. For YAML files, the extension should be “yaml” or “yml”. For JSON files, the extension should be “json” or “js”.

Returns:

data – Python data contained in the file content

Return type:

data

pypeec.io.load_pickle(filename)

Load a pickle file.

Parameters:

filename (string) – Name and path of the file to be loaded.

Returns:

data – Python data contained in the file content

Return type:

data

pypeec.io.write_pickle(filename, data)

Write a pickle file.

Parameters:
  • filename (string) – Name and path of the file to be created.

  • data (data) – Python data to be saved.