helper module
Define utility functions to test out the TOML config file.
- check_type(instance, name, *args)[source]
Raise a warning if
argsare not all of typeinstance.Not matching the provided type does not stop the program from running.
- _find_according_to_nature(path, nature)[source]
Helper function to check if the path matches the desired nature.
- find_path(toml_folder, path, nature=None)[source]
Look for the given path in all possible places, make it absolute.
We sequentially check and return the first valid path: 1. If
pathis aPathobject, resolve and check its existence. 2. Ifpathexists relative totoml_folder. 3. Ifpathis absolute.- Parameters:
- Return type:
- Returns:
Absolute path, whose existence has been checked.
- Raises:
FileNotFoundError – Raised if the required path does not exists.
- find_file(toml_folder, path, *, nature='file')
Look for the given path in all possible places, make it absolute.
We sequentially check and return the first valid path: 1. If
pathis aPathobject, resolve and check its existence. 2. Ifpathexists relative totoml_folder. 3. Ifpathis absolute.- Parameters:
toml_folder – Folder where the
TOMLconfiguration file is.path – Path to look for.
nature (default:
'file') – The type of path to check: “file” or “folder”, or None to simply check existence.
- Returns:
Absolute path, whose existence has been checked.
- Raises:
FileNotFoundError – Raised if the required path does not exists.
- Return type:
- find_folder(toml_folder, path, *, nature='folder')
Look for the given path in all possible places, make it absolute.
We sequentially check and return the first valid path: 1. If
pathis aPathobject, resolve and check its existence. 2. Ifpathexists relative totoml_folder. 3. Ifpathis absolute.- Parameters:
toml_folder – Folder where the
TOMLconfiguration file is.path – Path to look for.
nature (default:
'folder') – The type of path to check: “file” or “folder”, or None to simply check existence.
- Returns:
Absolute path, whose existence has been checked.
- Raises:
FileNotFoundError – Raised if the required path does not exists.
- Return type: