axon_synthesis.base_path_builder

Module to define a base class for relative paths storage and processing.

Classes

BasePathBuilder(path, *[, exists, create])

A base class to store relative file paths.

FILE_SELECTION(value[, names, module, ...])

class axon_synthesis.base_path_builder.BasePathBuilder(path: str | PathLike, *, exists: bool = False, create: bool = False)

Bases: object

A base class to store relative file paths.

assert_exists(*, file_selection=FILE_SELECTION.REQUIRED_ONLY)

Raise a ‘FileNotFoundError’ exception if the relevant files do not exist.

classmethod build_default_paths(path, filenames=None, optional_keys=None) dict[str, Path]

Build the default paths to the associated data files of the class.

build_paths(path) dict[str, Path]

Build the paths to the associated data files.

create_dirs(*, file_selection: FILE_SELECTION = FILE_SELECTION.REQUIRED_ONLY)

Create sub-directories.

create_root()

Ensure the root path exists.

exists(*, file_selection=FILE_SELECTION.REQUIRED_ONLY)

Check if all the paths exist.

property filenames

Return the paths to the associated data files.

filenames_from_type(*, file_selection: FILE_SELECTION = FILE_SELECTION.ALL) dict[str, Path]

Return the associated files according to the given filter tag.

is_subdir(key)

Check if a given key is registered as a subdirectory.

missing_files(*, file_selection=FILE_SELECTION.REQUIRED_ONLY)

Get the list of missing files based on a given type (required, optional or all).

property optional_filenames

Return the optional files.

property path: Path

Return the associated path.

raise_missing_files(*, file_selection=FILE_SELECTION.REQUIRED_ONLY, missing_files=None)

Raise a ‘FileNotFoundError’ exception with the relevant list of missing files.

property required_filenames

Return the required files.

reset_path(path)

Return the associated path.

update_from_dict(key, attr_name, data)

Update an attribute from a given dictionary if the requested value is not None.

class axon_synthesis.base_path_builder.FILE_SELECTION(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum