Dict¶
-
class
ctapipe.core.traits.
Dict
(value_trait=None, per_key_traits=None, key_trait=None, default_value=traitlets.Undefined, **kwargs)¶ Bases:
traitlets.traitlets.Instance
An instance of a Python dict.
One or more traits can be passed to the constructor to validate the keys and/or values of the dict. If you need more detailed validation, you may use a custom validator method.
Changed in version 5.0: Added key_trait for validating dict keys.
Changed in version 5.0: Deprecated ambiguous
trait
,traits
args in favor ofvalue_trait
,per_key_traits
.Methods Summary
class_init
(cls, name)Part of the initialization which may depend on the underlying HasDescriptors class.
element_error
(obj, element, validator[, side])from_string
(s)Load value from a single string
from_string_list
(s_list)Return a dict from a list of config strings.
Cast a single-key dict from a string.
subclass_init
(cls)validate
(obj, value)validate_elements
(obj, value)Methods Documentation
-
class_init
(cls, name)[source]¶ Part of the initialization which may depend on the underlying HasDescriptors class.
It is typically overloaded for specific types.
This method is called by
MetaHasDescriptors.__init__()
passing the class (cls
) andname
under which the descriptor has been assigned.
-
from_string_list
(s_list)[source]¶ Return a dict from a list of config strings.
This is where we parse CLI configuration.
Each item should have the form
"key=value"
.item parsing is done in
item_from_string()
.
-
item_from_string
(s)[source]¶ Cast a single-key dict from a string.
Evaluated when parsing CLI configuration from a string.
Dicts expect strings of the form key=value.
Returns a one-key dictionary, which will be merged in
from_string_list()
.
-