raffalib.mypickle

Functions

read_pickle(file)

Read and decode a jsonpickle-encoded object from a file.

write_pickle(data, dir_path, file_stem)

Encode an object with jsonpickle and write it to a timestamped file.

Module Contents

raffalib.mypickle.read_pickle(file: pathlib.Path)

Read and decode a jsonpickle-encoded object from a file.

Parameters:

file (Path) – Path to the file to read.

Returns:

The decoded Python object.

raffalib.mypickle.write_pickle(data, dir_path: pathlib.Path, file_stem: str)

Encode an object with jsonpickle and write it to a timestamped file.

The output file is named {file_stem}_{YYYY-MM-DD-HH-MM-SS} inside dir_path.

Parameters:
  • data – The object to encode and write.

  • dir_path (Path) – Directory in which to write the file.

  • file_stem (str) – Stem used to build the output file name.

Returns:

None

Return type:

None