lsst.pex.config
13.0-1-g41367f3+6
|
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 | |
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 280 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.__init__ | ( | self, | |
doc, | |||
typemap, | |||
default = None , |
|||
optional = False , |
|||
multi = False |
|||
) |
Definition at line 320 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 407 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.__get__ | ( | self, | |
instance, | |||
owner = None |
|||
) |
Definition at line 339 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.__set__ | ( | self, | |
instance, | |||
value, | |||
at = None , |
|||
label = "assignment" |
|||
) |
Definition at line 345 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.freeze | ( | self, | |
instance | |||
) |
Definition at line 392 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.rename | ( | self, | |
instance | |||
) |
Definition at line 359 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.save | ( | self, | |
outfile, | |||
instance | |||
) |
Definition at line 397 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.toDict | ( | self, | |
instance | |||
) |
Definition at line 376 of file configChoiceField.py.
def lsst.pex.config.configChoiceField.ConfigChoiceField.validate | ( | self, | |
instance | |||
) |
Definition at line 364 of file configChoiceField.py.
|
static |
Definition at line 318 of file configChoiceField.py.
lsst.pex.config.configChoiceField.ConfigChoiceField.multi |
Definition at line 325 of file configChoiceField.py.
lsst.pex.config.configChoiceField.ConfigChoiceField.typemap |
Definition at line 324 of file configChoiceField.py.