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:
- docstr
- 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. 
- optionalbool, optional
- Set whether the field is optional. When - False,- lsst.pex.config.Config.validatewill fail if the field’s value is- None.
- listCheckcallable, optional
- A callable that validates the list as a whole. 
- itemCheckcallable, optional
- A callable that validates individual items in the list. 
- lengthint, optional
- If set, this field must contain exactly - lengthnumber of items.
- minLengthint, optional
- If set, this field must contain at least - minLengthnumber of items.
- maxLengthint, 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. 
 
- doc
 - See also - Attributes Summary - Supported data types for field values ( - setof types).- Methods Summary - freeze(instance)- Make this field read-only (for internal use only). - rename(instance)- Rename the field in a - Config(for internal use only).- save(outfile, instance)- Save this field to a file (for internal use only). - toDict(instance)- Convert the value of this field to a plain - list.- validate(instance)- Validate the field. - Attributes Documentation - supportedTypes = {<class 'bool'>, <class 'complex'>, <class 'float'>, <class 'str'>, <class 'int'>}¶
- Supported data types for field values ( - setof types).
 - Methods Documentation - freeze(instance)¶
- Make this field read-only (for internal use only). - Parameters:
- instancelsst.pex.config.Config
- The config instance that contains this field. 
 
- instance
 - Notes - Freezing is only relevant for fields that hold subconfigs. Fields which hold subconfigs should freeze each subconfig. - Subclasses should implement this method. 
 - rename(instance)¶
- Rename the field in a - Config(for internal use only).- Parameters:
- instancelsst.pex.config.Config
- The config instance that contains this field. 
 
- instance
 - Notes - This method is invoked by the - lsst.pex.config.Configobject that contains this field and should not be called directly.- Renaming is only relevant for - Fieldinstances that hold subconfigs.- Fields that hold subconfigs should rename each subconfig with the full field name as generated by- lsst.pex.config.config._joinNamePath.
 - save(outfile, instance)¶
- Save this field to a file (for internal use only). - Parameters:
 - Notes - This method is invoked by the - Configobject that contains this field and should not be called directly.- The output consists of the documentation string ( - lsst.pex.config.Field.doc) formatted as a Python comment. The second line is formatted as an assignment:- {fullname}={value}.- This output can be executed with Python. 
 - toDict(instance)¶
- Convert the value of this field to a plain - list.- lsst.pex.config.Config.toDictis the primary user of this method.- Parameters:
- instancelsst.pex.config.Config
- The config instance that contains this field. 
 
- instance
- Returns:
 
 - validate(instance)¶
- Validate the field. - Parameters:
- instancelsst.pex.config.Config
- The config instance that contains this field. 
 
- instance
- Raises:
 - Notes - Individual item checks ( - itemCheck) are applied when each item is set and are not re-checked by this method.