coma.hooks.run_hook
Run hook utilities, factories, and defaults.
- factory(attr_name: str = 'run') Callable [source]
Factory for creating a run hook that executes a command.
Example:
class Command: def start(self): ... with coma.forget(run_hook=True): coma.register("cmd", Command, run_hook=factory("start"))
- Parameters
attr_name (str) – The name of the command attribute to call to execute it
- Returns
A run hook
- default(command)
Default init hook function.
An alias for calling
coma.hooks.run_hook.factory()
with default arguments.