MappingFactory¶
-
class
lsst.daf.butler.
MappingFactory
(refType)¶ Bases:
object
Register the mapping of some key to a python type and retrieve instances.
Enables instances of these classes to be retrieved from the factory later. The class can be specified as an object, class or string. If the key is an object it is converted to a string by accessing a
name
attribute.Parameters: Methods Summary
getFromRegistry
(*targetClasses)Get a new instance of the object stored in the registry. getFromRegistryWithMatch
(*targetClasses)Get a new instance of the object stored in the registry along with the matching key. getLookupKeys
()Retrieve the look up keys for all the registry entries. normalizeRegistryDimensions
(universe)Normalize dimensions used in registry keys to the supplied universe. placeInRegistry
(registryKey, typeName)Register a class name with the associated type. Methods Documentation
-
getFromRegistry
(*targetClasses)¶ Get a new instance of the object stored in the registry.
Parameters: Returns: - instance :
object
Instance of class stored in registry associated with the first matching target class.
Raises: - KeyError
Raised if none of the supplied target classes match an item in the registry.
- instance :
-
getFromRegistryWithMatch
(*targetClasses)¶ Get a new instance of the object stored in the registry along with the matching key.
Parameters: Returns: Raises: - KeyError
Raised if none of the supplied target classes match an item in the registry.
-
getLookupKeys
()¶ Retrieve the look up keys for all the registry entries.
Returns:
-
normalizeRegistryDimensions
(universe)¶ Normalize dimensions used in registry keys to the supplied universe.
Parameters: - universe :
DimensionUniverse
The set of all known dimensions. If
None
, returns without action.
Raises: - ValueError
Raised if a key exists where a dimension is not part of the
universe
.
Notes
Goes through all registered templates, and for keys that include dimensions, rewrites those keys to use a verified set of dimensions.
Returns without action if the template keys have already been normalized.
- universe :
-
placeInRegistry
(registryKey, typeName)¶ Register a class name with the associated type.
Parameters: Raises: - KeyError
Raised if item is already registered and has different value.
-