NonemptyMapping¶
- class lsst.daf.butler.nonempty_mapping.NonemptyMapping(default_factory: Callable[[], _V])¶
- Bases: - Mapping[- _K,- _V]- A - Mappingthat implicitly adds values (like- defaultdict) but treats any that evaluate to- Falseas not present.- Parameters:
- default_factoryCallable
- A callable that takes no arguments and returns a new instance of the value type. 
 
- default_factory
 - Notes - Unlike - defaultdict, this class implements only- collections.abc.Mapping, not- MutableMapping, and hence it can be modified only by invoking- __getitem__with a key that does not exist. It is expected that the value type will be a mutable container like- setor- dict, and that an empty nested container should be considered equivalent to the absence of a key. The value type must have a- copymethod that copies all mutable state.- Methods Summary - copy()- Return a copy of the mapping. - get()- D.get(k[,d]) -> D[k] if k in D, else d. - Methods Documentation - copy() NonemptyMapping[_K, _V]¶
- Return a copy of the mapping. - This deep-copies values while referencing the - default_factorycallback and keys.