check_hook#
Contract for transformations run by check-dev-files.
- class FileSet(paths: tuple[Path, ...] = (), directories: tuple[Path, ...] = (), patterns: tuple[str, ...] = ())[source]#
Bases:
objectPaths whose staged modification should activate a check hook.
Directories match every file below them. Patterns are regular-expression alternatives for path families that cannot be expressed as one exact path.
- class CheckContext(is_python_repo: bool, has_notebooks: bool, doc_apt_packages: list[str], environment_variables: dict[str, str])[source]#
Bases:
objectRepository properties that are derived once and shared by every check.
- class CheckHook(group: ~typing.Literal['python', 'github', 'env', 'nb', 'format', 'repo'], files: ~compwa_policy.utilities.check_hook.FileSet, run: ~collections.abc.Callable[[~compwa_policy.utilities.session.Session, ~compwa_policy.Arguments, ~compwa_policy.utilities.check_hook.CheckContext], None], enabled: ~collections.abc.Callable[[~compwa_policy.Arguments, ~compwa_policy.utilities.check_hook.CheckContext], bool] = <function _always_enabled>)[source]#
Bases:
objectOne policy transformation together with its dispatch metadata.
- check_hook(*, group: ~typing.Literal['python', 'github', 'env', 'nb', 'format', 'repo'], paths: ~collections.abc.Iterable[~pathlib.Path | str] = (), directories: ~collections.abc.Iterable[~pathlib.Path | str] = (), patterns: ~collections.abc.Iterable[str] = (), enabled: ~collections.abc.Callable[[~compwa_policy.Arguments, ~compwa_policy.utilities.check_hook.CheckContext], bool] = <function _always_enabled>) Callable[[Callable[[Session, Arguments, CheckContext], None]], CheckHook][source]#
Attach dispatch and trigger metadata to a
checkfunction.