ChoiceField#

class lsst.pex.config.ChoiceField(doc, dtype=None, allowed=None, default=None, optional=True, deprecated=None)#

Bases: Field[FieldTypeVar]

A configuration field (Field subclass) that allows a user to select from a predefined set of values.

Use ChoiceField when a configuration can only take one of a predefined set of values. Each choice must be of the same type.

Parameters#

docstr

Documentation string that describes the configuration field.

dtypeclass

The type of the field’s choices. For example, str or int.

alloweddict

The allowed values. Keys are the allowed choices (of dtype-type). Values are descriptions (str-type) of each choice.

defaultdtype-type, optional

The default value, which is of type dtype and one of the allowed choices.

optionalbool, optional

If True, this configuration field is optional. Default is True.

deprecatedNone or str, optional

A description of why this Field is deprecated, including removal date. If not None, the string is appended to the docstring for this Field.

See Also#

ConfigChoiceField ConfigDictField ConfigField ConfigurableField DictField Field ListField RangeField RegistryField