A metaclass for abstract mappings whose key type is implied by their
constructor arguments.
This metaclass requires that the mapping have a `dict`-like constructor,
i.e., it takes a mapping or an iterable of key-value pairs as its first
positional parameter.
This class differs from `~lsst.utils.TemplateMeta` only in that the dtype
(or equivalent) constructor keyword is optional. If it is omitted, the
class will attempt to infer it from the first argument.
Definition at line 122 of file _GenericMap.py.
lsst.afw.typehandling._GenericMap.AutoKeyMeta._guessKeyType |
( |
| cls, |
|
|
| inputData ) |
|
protected |
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.