NamedKeyMapping

class lsst.daf.butler.NamedKeyMapping

Bases: Mapping[K, V_co]

Custom mapping class.

An abstract base class for custom mappings whose keys are objects with a str name attribute, for which lookups on the name as well as the object are permitted.

Notes

In addition to the new names property and byName method, this class simply redefines the type signature for __getitem__ and get that would otherwise be inherited from Mapping. That is only relevant for static type checking; the actual Python runtime doesn’t care about types at all.

Attributes Summary

names

Return the set of names associated with the keys, in the same order.

Methods Summary

byName()

Return a Mapping with names as keys and the self values.

get()

D.get(k[,d]) -> D[k] if k in D, else d.

keys()

Attributes Documentation

names

Return the set of names associated with the keys, in the same order.

(Set [ str ]).

Methods Documentation

byName() dict[str, +V_co]

Return a Mapping with names as keys and the self values.

Returns:
dictionarydict

A dictionary with the same values (and iteration order) as self, with str names as keys. This is always a new object, not a view.

get(key: object) V_co | None
get(key: object, default: V) V_co | V

D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.

abstract keys() a set-like object providing a view on D's keys