lsst.pex.config  16.0
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pex.config.rangeField.RangeField Class Reference
Inheritance diagram for lsst.pex.config.rangeField.RangeField:
lsst.pex.config.config.Field

Public Member Functions

def __init__ (self, doc, dtype, default=None, optional=False, min=None, max=None, inclusiveMin=True, inclusiveMax=False)
 
def rename (self, instance)
 
def validate (self, instance)
 
def freeze (self, instance)
 
def save (self, outfile, instance)
 
def toDict (self, instance)
 
def __get__ (self, instance, owner=None, at=None, label="default")
 
def __set__ (self, instance, value, at=None, label='assignment')
 
def __delete__ (self, instance, at=None, label='deletion')
 

Public Attributes

 min
 
 max
 
 maxCheck
 
 minCheck
 
 rangeString
 
 dtype
 
 doc
 
 default
 
 check
 
 optional
 
 source
 

Static Public Attributes

 supportedTypes = set((int, float))
 

Detailed Description

Defines a Config Field which allows only a range of values.
The range is defined by providing min and/or max values.
If min or max is None, the range will be open in that direction
If inclusive[Min|Max] is True the range will include the [min|max] value

Definition at line 29 of file rangeField.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pex.config.rangeField.RangeField.__init__ (   self,
  doc,
  dtype,
  default = None,
  optional = False,
  min = None,
  max = None,
  inclusiveMin = True,
  inclusiveMax = False 
)

Definition at line 41 of file rangeField.py.

Member Function Documentation

◆ __delete__()

def lsst.pex.config.config.Field.__delete__ (   self,
  instance,
  at = None,
  label = 'deletion' 
)
inherited
Describe how attribute deletion should occur on the Config instance.
This is invoked by the owning config object and should not be called
directly

Definition at line 344 of file config.py.

◆ __get__()

def lsst.pex.config.config.Field.__get__ (   self,
  instance,
  owner = None,
  at = None,
  label = "default" 
)
inherited
Define how attribute access should occur on the Config instance
This is invoked by the owning config object and should not be called
directly

When the field attribute is accessed on a Config class object, it
returns the field object itself in order to allow inspection of
Config classes.

When the field attribute is access on a config instance, the actual
value described by the field (and held by the Config instance) is
returned.

Definition at line 287 of file config.py.

◆ __set__()

def lsst.pex.config.config.Field.__set__ (   self,
  instance,
  value,
  at = None,
  label = 'assignment' 
)
inherited
Describe how attribute setting should occur on the config instance.
This is invoked by the owning config object and should not be called
directly

Derived Field classes may need to override the behavior. When overriding
__set__, Field authors should follow the following rules:
* Do not allow modification of frozen configs
* Validate the new value *BEFORE* modifying the field. Except if the
    new value is None. None is special and no attempt should be made to
    validate it until Config.validate is called.
* Do not modify the Config instance to contain invalid values.
* If the field is modified, update the history of the field to reflect the
    changes

In order to decrease the need to implement this method in derived Field
types, value validation is performed in the method _validateValue. If
only the validation step differs in the derived Field, it is simpler to
implement _validateValue than to re-implement __set__. More complicated
behavior, however, may require a reimplementation.

Definition at line 306 of file config.py.

◆ freeze()

def lsst.pex.config.config.Field.freeze (   self,
  instance 
)
inherited
Make this field read-only.
Only important for fields which hold sub-configs.
Fields which hold subconfigs should freeze each sub-config.

Definition at line 226 of file config.py.

◆ rename()

def lsst.pex.config.config.Field.rename (   self,
  instance 
)
inherited
Rename an instance of this field, not the field itself.
This is invoked by the owning config object and should not be called
directly

Only useful for fields which hold sub-configs.
Fields which hold subconfigs should rename each sub-config with
the full field name as generated by _joinNamePath

Definition at line 201 of file config.py.

◆ save()

def lsst.pex.config.config.Field.save (   self,
  outfile,
  instance 
)
inherited
Saves an instance of this field to file.
This is invoked by the owning config object, and should not be called
directly

outfile ---- an open output stream.

Definition at line 253 of file config.py.

◆ toDict()

def lsst.pex.config.config.Field.toDict (   self,
  instance 
)
inherited
Convert the field value so that it can be set as the value of an item
in a dict.
This is invoked by the owning config object and should not be called
directly

Simple values are passed through. Complex data structures must be
manipulated. For example, a field holding a sub-config should, instead
of the subconfig object, return a dict where the keys are the field
names in the subconfig, and the values are the field values in the
subconfig.

Definition at line 272 of file config.py.

◆ validate()

def lsst.pex.config.config.Field.validate (   self,
  instance 
)
inherited
Base validation for any field.
Ensures that non-optional fields are not None.
Ensures type correctness
Ensures that user-provided check function is valid
Most derived Field types should call Field.validate if they choose
to re-implement validate

Definition at line 213 of file config.py.

Member Data Documentation

◆ check

lsst.pex.config.config.Field.check
inherited

Definition at line 197 of file config.py.

◆ default

lsst.pex.config.config.Field.default
inherited

Definition at line 196 of file config.py.

◆ doc

lsst.pex.config.config.Field.doc
inherited

Definition at line 194 of file config.py.

◆ dtype

lsst.pex.config.config.Field.dtype
inherited

Definition at line 193 of file config.py.

◆ max

lsst.pex.config.rangeField.RangeField.max

Definition at line 55 of file rangeField.py.

◆ maxCheck

lsst.pex.config.rangeField.RangeField.maxCheck

Definition at line 58 of file rangeField.py.

◆ min

lsst.pex.config.rangeField.RangeField.min

Definition at line 54 of file rangeField.py.

◆ minCheck

lsst.pex.config.rangeField.RangeField.minCheck

Definition at line 62 of file rangeField.py.

◆ optional

lsst.pex.config.config.Field.optional
inherited

Definition at line 198 of file config.py.

◆ rangeString

lsst.pex.config.rangeField.RangeField.rangeString

Definition at line 66 of file rangeField.py.

◆ source

lsst.pex.config.config.Field.source
inherited

Definition at line 199 of file config.py.

◆ supportedTypes

lsst.pex.config.rangeField.RangeField.supportedTypes = set((int, float))
static

Definition at line 38 of file rangeField.py.


The documentation for this class was generated from the following file: