22 __all__ = [
"SimpleGenericMap"]
25 from ._typehandling
import SimpleGenericMapS
26 from ._GenericMap
import MutableGenericMap, AutoKeyMeta
30 """A `dict`-like `~collections.abc.MutableMapping` for use when sharing a
31 map between C++ and Python.
33 For compatibility with C++, ``SimpleGenericMap`` has the following
36 - all keys must be of the same type
37 - values must be built-in types or subclasses of
38 `lsst.afw.typehandling.Storable`. Almost any user-defined class in
39 C++ or Python can have `~lsst.afw.typehandling.Storable` as a mixin.
41 As a safety precaution, `~lsst.afw.typehandling.Storable` objects that are
42 added from C++ may be copied when you retrieve them from Python, making it
43 impossible to modify them in-place. This issue does not affect objects that
44 are added from Python, or objects that are always passed by
45 :cpp:class:`shared_ptr` in C++.
49 mapping : `collections.abc.Mapping`, optional
50 iterable : iterable, optional
51 dtype : `type`, optional
52 The type of key the map accepts. Not required if ``mapping`` or
53 ``iterable`` is provided.
55 Aside from the ``dtype`` keyword, a ``SimpleGenericMap`` takes the same
56 input arguments as `dict`.
60 return cls({key: value
for key
in iterable})
63 SimpleGenericMap.register(str, SimpleGenericMapS)
67 _oldInit = SimpleGenericMapS.__init__
75 self.update(source, **kwargs)