NamedKeyDict¶
- class lsst.daf.butler.NamedKeyDict(*args: Any)¶
- Bases: - NamedKeyMutableMapping[- K,- V]- Dictionary wrapper for named keys. - Requires keys to have a - .nameattribute, and permits lookups using either key objects or their names.- Names can be used in place of keys when updating existing items, but not when adding new items. - It is assumed (but asserted) that all name equality is equivalent to key equality, either because the key objects define equality this way, or because different objects with the same name are never included in the same dictionary. - Parameters:
- *argstyping.Any
- All positional constructor arguments are forwarded directly to - dict. Keyword arguments are not accepted, because plain strings are not valid keys for- NamedKeyDict.
 
- *args
- Raises:
- AttributeError
- Raised when an attempt is made to add an object with no - .nameattribute to the dictionary.
- AssertionError
- Raised when multiple keys have the same name. 
 
 - Attributes Summary - Return set of names associated with the keys, in the same order. - Methods Summary - byName()- Return a - dictwith names as keys and the- selfvalues.- copy()- Return a new - NamedKeyDictwith the same elements.- freeze()- Disable all mutators. - items()- keys()- values()- Attributes Documentation - Methods Documentation - copy() NamedKeyDict[K, V]¶
- Return a new - NamedKeyDictwith the same elements.
 - freeze() NamedKeyMapping[K, V]¶
- Disable all mutators. - Effectively transforms - selfinto an immutable mapping.- Returns:
- selfNamedKeyMapping
- While - selfis modified in-place, it is also returned with a type annotation that reflects its new, frozen state; assigning it to a new variable (and considering any previous references invalidated) should allow for more accurate static type checking.
 
- self
 
 - items() a set-like object providing a view on D's items¶
 - keys() a set-like object providing a view on D's keys¶
 - values() an object providing a view on D's values¶