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. 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
None of the supplied target classes match an item in the registry.
- instance :
-
placeInRegistry
(registryKey, typeName)¶ Register a class name with the associated type.
The type name provided is validated against the reference class,
refType
attribute, if defined.Parameters: Raises: - ValueError
If instance of class is not of the expected type.
- KeyError
If item is already registered and has different value.
-