files

files#

Tools for paths and files

Functions

add_to_zip(zip_path, dirs_to_add)

Add folders to an already existing zip file (recursively).

archive(folder_path, archive_path[, fmt])

Archives a folder recursively.

copy(src, dst)

Copy a file or a directory (recursively) with copytree or copy2.

extract_file(file_path, output[, overwrite])

Extract an archived file (zip or others).

extract_files(archives, output[, overwrite])

Extract all archived files.

hash_file_content(file_content[, len_param])

Hash a file into a unique str.

load_obj(path)

Load a pickled object.

read_archived_file(archive_path, regex[, ...])

Read archived file (in bytes) from zip or tar archives.

read_archived_html(archive_path, regex[, ...])

Read archived HTML from zip or tar archives.

read_archived_xml(archive_path[, regex, ...])

Read archived XML from zip or tar archives.

read_json(json_file[, print_file])

Read a JSON file

read_yaml(yaml_file[, print_file])

Read a YAML file

remove(path)

Deletes a file or a directory (recursively) using shutil.rmtree or os.remove.

remove_by_pattern(directory[, ...])

Remove files corresponding to a pattern from a directory.

save_json(json_dict, output_json, **kwargs)

save_obj(obj, path, **kwargs)

Save an object as a pickle (can save any Python objects).

save_yaml(yaml_dict, output_yaml, **kwargs)

Save a YAML file

Classes

CustomDecoder(*args, **kwargs)

Decoder for JSON with methods for datetimes

CustomJsonEncoder(*[, skipkeys, ...])

Encoder for JSON with methods for datetimes and np.int64

CustomYamlDumper(*args, **kwargs)