config.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 args are not all of type instance.

Not matching the provided type does not stop the program from running.

dict_for_pretty_output(some_kw: dict) str

Transform a dict in strings for nice output.

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:

1. If file is a Path object, we consider that the user already set it as he wanted. We check if it exists. 2. If file is in toml_folder. 3. If file is absolute.

Parameters:
  • toml_folder (Path) – Folder where the .toml configuration file is.

  • file (str | Path) – Filepath to look for.

Returns:

file – Absolute filepath, which existence has been checked.

Return type:

Path