A `dict`-like `~collections.abc.MutableMapping` for use when sharing a
map between C++ and Python.
For compatibility with C++, ``SimpleGenericMap`` has the following
restrictions:
- all keys must be of the same type
- values must be built-in types or subclasses of
`lsst.afw.typehandling.Storable`. Almost any user-defined class in
C++ or Python can have `~lsst.afw.typehandling.Storable` as a mixin.
As a safety precaution, `~lsst.afw.typehandling.Storable` objects that are
added from C++ may be copied when you retrieve them from Python, making it
impossible to modify them in-place. This issue does not affect objects that
are added from Python, or objects that are always passed by
:cpp:class:`shared_ptr` in C++.
Parameters
----------
mapping : `collections.abc.Mapping`, optional
iterable : iterable, optional
dtype : `type`, optional
The type of key the map accepts. Not required if ``mapping`` or
``iterable`` is provided.
**kwargs
Aside from the ``dtype`` keyword, a ``SimpleGenericMap`` takes the same
input arguments as `dict`.
Definition at line 29 of file _SimpleGenericMap.py.
| lsst.afw.typehandling._GenericMap.AutoKeyMeta._guessKeyType |
( |
| cls, |
|
|
| inputData ) |
|
protectedinherited |
Try to infer the key type of a map from its input.
Parameters
----------
inputData : `~collections.abc.Mapping` or iterable of pairs
Any object that can be passed to a `dict`-like constructor. Keys
are assumed homogeneous (if not, a
`~lsst.afw.typehandling.GenericMap` constructor will raise
`TypeError` no matter what key type, if any, is provided).
Returns
-------
keyType : `type`
The type of the keys in ``inputData``, or `None` if the type could
not be inferred.
Definition at line 149 of file _GenericMap.py.