psetterΒΆ
- pconfigs.psetter(*, construct=None, type=None, inputs=None)[source]ΒΆ
Helper for constructing pconfig instances.
See also
For examples, see Make short property functions with psetter.
This function has two keyword-only modes of operation:
psetter(type=MyConfig, inputs=...): Given a pconfig class and an optional inputs, return aPSetterview that can be used to succintly set config values that are deeply nested within sub-configs of the config.psetter(construct=...): Given an existingPSetterinstance, return the fully constructed config object it represents.
- Parameters:
construct (PSetter, keyword-only) β An existing
PSetterinstance to be materialized into its underlying config. Must not be combined withtypeorinputs.type (Type[CT] | None, keyword-only) β A pconfig class for which a
PSetterview should be created. Must not be combined withconstruct.inputs (Any, optional, keyword-only) β Optional initial inputs for the created
PSetterwhen using thetype=...form.
- Returns:
Either the constructed config instance (when
constructis provided) or aPSetterview (whentypeandinputsare provided).- Return type:
Type | PSetter[Type]
- Raises:
TypeError β If incompatible combinations of arguments are provided (for example, both
constructandtype), or if neitherconstructnortypeis given.