LSSTApplications
10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
|
Public Member Functions | |
def | __init__ |
def | __get__ |
def | __set__ |
def | rename |
def | validate |
def | toDict |
def | freeze |
def | save |
def | __deepcopy__ |
Public Attributes | |
typemap | |
multi | |
Static Public Attributes | |
instanceDictClass = ConfigInstanceDict | |
Private Member Functions | |
def | _getOrMake |
def | _compare |
ConfigChoiceFields allow the config to choose from a set of possible Config types. The set of allowable types is given by the typemap argument to the constructor The typemap object must implement typemap[name], which must return a Config subclass. While the typemap is shared by all instances of the field, each instance of the field has its own instance of a particular sub-config type For example: class AaaConfig(Config): somefield = Field(int, "...") TYPEMAP = {"A", AaaConfig} class MyConfig(Config): choice = ConfigChoiceField("doc for choice", TYPEMAP) instance = MyConfig() instance.choice['AAA'].somefield = 5 instance.choice = "AAA" Alternatively, the last line can be written: instance.choice.name = "AAA" Validation of this field is performed only the "active" selection. If active is None and the field is not optional, validation will fail. ConfigChoiceFields can allow single selections or multiple selections. Single selection fields set selection through property name, and multi-selection fields use the property names. ConfigChoiceFields also allow multiple values of the same type: TYPEMAP["CCC"] = AaaConfig TYPEMAP["BBB"] = AaaConfig When saving a config with a ConfigChoiceField, the entire set is saved, as well as the active selection
Definition at line 260 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.__init__ | ( | self, | |
doc, | |||
typemap, | |||
default = None , |
|||
optional = False , |
|||
multi = False |
|||
) |
Definition at line 299 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.__deepcopy__ | ( | self, | |
memo | |||
) |
Customize deep-copying, because we always want a reference to the original typemap. WARNING: this must be overridden by subclasses if they change the constructor signature!
Definition at line 385 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.__get__ | ( | self, | |
instance, | |||
owner = None |
|||
) |
Definition at line 317 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.__set__ | ( | self, | |
instance, | |||
value, | |||
at = None , |
|||
label = "assignment" |
|||
) |
Definition at line 323 of file configChoiceField.py.
|
private |
Helper function for Config.compare; used to compare two fields for equality. Only the selected config(s) are compared, as the parameters of any others do not matter. @param[in] instance1 LHS Config instance to compare. @param[in] instance2 RHS Config instance to compare. @param[in] shortcut If True, return as soon as an inequality is found. @param[in] rtol Relative tolerance for floating point comparisons. @param[in] atol Absolute tolerance for floating point comparisons. @param[in] output If not None, a callable that takes a string, used (possibly repeatedly) to report inequalities. Floating point comparisons are performed by numpy.allclose; refer to that for details.
Definition at line 395 of file configChoiceField.py.
|
private |
Definition at line 305 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.freeze | ( | self, | |
instance | |||
) |
Definition at line 370 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.rename | ( | self, | |
instance | |||
) |
Definition at line 337 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.save | ( | self, | |
outfile, | |||
instance | |||
) |
Definition at line 375 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.toDict | ( | self, | |
instance | |||
) |
Definition at line 354 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.validate | ( | self, | |
instance | |||
) |
Definition at line 342 of file configChoiceField.py.
|
static |
Definition at line 298 of file configChoiceField.py.
lsst.pex.config.configChoiceField.ConfigChoiceField.multi |
Definition at line 303 of file configChoiceField.py.
lsst.pex.config.configChoiceField.ConfigChoiceField.typemap |
Definition at line 302 of file configChoiceField.py.