helper module
Define utility functions to test out the .toml config file.
- check_type(instance: type | tuple[type], name: str, *args: Any) None
Raise a warning if
argsare not all of typeinstance.Not matching the provided type does not stop the program from running.
- find_file(toml_folder: Path, file: str | Path) Path
Look for the given filepath in all possible places, make it absolute.
We sequentially check and return the first valid path:
If
fileis aPathobject, we consider that the user already set it as he wanted. We check if it exists.If
fileis intoml_folder.If
fileis absolute.
- Parameters:
toml_folder (pathlib.Path) – Folder where the
.tomlconfiguration file is.file (str | pathlib.Path) – Filepath to look for.
- Returns:
file – Absolute filepath, which existence has been checked.
- Return type: