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:

  1. psetter(type=MyConfig, inputs=...): Given a pconfig class and an optional inputs, return a PSetter view that can be used to succintly set config values that are deeply nested within sub-configs of the config.

  2. psetter(construct=...): Given an existing PSetter instance, return the fully constructed config object it represents.

Parameters:
  • construct (PSetter, keyword-only) – An existing PSetter instance to be materialized into its underlying config. Must not be combined with type or inputs.

  • type (Type[CT] | None, keyword-only) – A pconfig class for which a PSetter view should be created. Must not be combined with construct.

  • inputs (Any, optional, keyword-only) – Optional initial inputs for the created PSetter when using the type=... form.

Returns:

Either the constructed config instance (when construct is provided) or a PSetter view (when type and inputs are provided).

Return type:

Type | PSetter[Type]

Raises:

TypeError – If incompatible combinations of arguments are provided (for example, both construct and type), or if neither construct nor type is given.