repo_helper.files
The files subpackage contains most of the functions for managing files.
-
Manager Type hint for a function that manages files.
Alias of
Callable[[Path,Environment],List[str]]
-
class
Management(*args, **kwargs)[source] Bases:
UserList[Tuple[Callable[[Path,Environment],List[str]],str,Sequence[str]]]Class to store functions that manage files.
The syntax of each entry is:
the function,
a string to use in
exclude_filesto disable this function,a list of strings representing config values that must be true to call the function.
Methods:
register(exclude_name[, …])Decorator to register a function.
-
register(exclude_name, exclude_unless_true=(), *, name=None)[source] Decorator to register a function.
The function must have the following signature:
def function( repo_path: pathlib.Path, templates: jinja2.Environment, ) -> List[str]: ...
- Parameters
exclude_name (
str) – A string to use in ‘exclude_files’ to disable this function.exclude_unless_true (
Sequence[str]) – A list of strings representing config values that must be true to call the function. Default().name (
Optional[str]) – Optional name to use for the function in the output. Defaults to the name of the function.
- Return type
- Returns
The registered function.
- Raises
SyntaxErrorif the decorated function does not take the correct arguments.
-
is_registered(obj)[source] Return whether
objis a registered function.- Parameters
obj (
Any)
- Return type
Submodules