pyiron_base.storage.fileio module

Functions for reading and writing data files.

class pyiron_base.storage.fileio.FileAdapter(parse, write)

Bases: tuple

parse

Alias for field number 0

write

Alias for field number 1

pyiron_base.storage.fileio.read(file_name)

Read data from a file.

Format is determined from the file extension as follows - yaml: .yaml, .yml

Parameters:

file_name (str) – file name, extension defines which format is used

Returns:

nested dict/list

Raises:

ValueError – if given filename doesn’t have one of the specified extensions

pyiron_base.storage.fileio.write(data, file_name)

Writes the data to a file.

Format is determined from the file extension as follows - yaml: .yaml, .yml

Parameters:
  • data (nested dict/list) – data to save to file, dictionary keys must be str!

  • file_name (str) – file name, extension defines which format is used

Raises:

ValueError – if given filename doesn’t have one of the specified extensions