ListField#
- class lsst.pex.config.ListField(doc, dtype=None, default=None, optional=False, listCheck=None, itemCheck=None, length=None, minLength=None, maxLength=None, deprecated=None)#
Bases:
Field[List[FieldTypeVar]],Generic[FieldTypeVar]A configuration field (
Fieldsubclass) that contains a list of values of a specific type.Parameters#
- doc
str A description of the field.
- dtypeclass, optional
The data type of items in the list. Optional if supplied as typing argument to the class.
- defaultsequence, optional
The default items for the field.
- optional
bool, optional Set whether the field is optional. When
False,lsst.pex.config.Config.validatewill fail if the field’s value isNone.- listCheckcallable, optional
A callable that validates the list as a whole.
- itemCheckcallable, optional
A callable that validates individual items in the list.
- length
int, optional If set, this field must contain exactly
lengthnumber of items.- minLength
int, optional If set, this field must contain at least
minLengthnumber of items.- maxLength
int, optional If set, this field must contain no more than
maxLengthnumber of items.- 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#
ChoiceField ConfigChoiceField ConfigDictField ConfigField ConfigurableField DictField Field RangeField RegistryField
Methods Summary
toDict(instance)Convert the value of this field to a plain
list.validate(instance)Validate the field.
Methods Documentation
- toDict(instance)#
Convert the value of this field to a plain
list.lsst.pex.config.Config.toDictis the primary user of this method.Parameters#
- instance
lsst.pex.config.Config The config instance that contains this field.
Returns#
listPlain
listof items, orNoneif the field is not set.
- instance
- validate(instance)#
Validate the field.
Parameters#
- instance
lsst.pex.config.Config The config instance that contains this field.
Raises#
- lsst.pex.config.FieldValidationError
Raised if:
The field is not optional, but the value is
None.The list itself does not meet the requirements of the
length,minLength, ormaxLengthattributes.The
listCheckcallable returnsFalse.
Notes#
Individual item checks (
itemCheck) are applied when each item is set and are not re-checked by this method.- instance
- doc