coma.hooks.init_hook¶
Init hook default factory.
- default_factory(policy: OverridePolicy = OverridePolicy.RAISE, instance_key: str | None = None) Callable[[T], T | None][source]¶
Factory for creating an invocation hook with
init_hooksemantics.Essentially, creates and returns a hook function as a lightweight wrapper around
call_on()called on the current value of thecommandobject with the givenpolicyandinstance_key.- Parameters:
policy (
OverridePolicy) – Policy for dealing with any command-line argument whose name clashes with command parameters.instance_key (
InstanceKey, optional) – WhichConfiginstance to use (across all givenConfigs), orget_latest()ifNone.
- Returns:
A hook with
init_hooksemantics.- Return type: