coma.hooks.post_config_hook

Post config hook utilities, factories, and defaults.

single_cli_override_factory(config_id: str, cli_override: typing.Callable = <function override>) Callable[[...], Dict[str, Any]][source]

Factory for creating a post config hook that overrides a config’s attributes.

Overriding with command line arguments is achieved by calling cli_override, which is override() by default. Slight alternatives can be created using override_factory(). Alternatively, a custom function can also be used.

Example

Change separator to "~":

coma.initiate(..., post_config_hook=override_factory(sep="~"))
Parameters
  • config_id (str) – A config identifier

  • cli_override (Callable) – Function to override config attributes with command line arguments

Returns

A post config hook

multi_cli_override_factory(cli_override: typing.Callable = <function override>) Callable[[...], Dict[str, Any]][source]

Factory for creating a post config hook that overrides attributes of all configs.

Equivalent to calling single_cli_override_factory() for each config with cli_override passed along. See single_cli_override_factory() for details.

default(unknown_args: List[str], configs: Dict[str, Any]) Dict[str, Any]

Default post config hook.

An alias for calling multi_cli_override_factory() with default arguments.