StorageClassFactory¶
-
class
lsst.daf.butler.StorageClassFactory(config: Union[lsst.daf.butler.core.storageClass.StorageClassConfig, str, None] = None)¶ Bases:
objectFactory for
StorageClassinstances.This class is a singleton, with each instance sharing the pool of StorageClasses. Since code can not know whether it is the first time the instance has been created, the constructor takes no arguments. To populate the factory with storage classes, a call to
addFromConfig()should be made.Parameters: - config :
StorageClassConfigorstr, optional Load configuration. In a ButlerConfig` the relevant configuration is located in the
storageClassessection.
Methods Summary
addFromConfig(config, …)Add more StorageClassdefinitions from a config file.getStorageClass(storageClassName)Get a StorageClass instance associated with the supplied name. makeNewStorageClass(name, baseClass, **kwargs)Create a new Python class as a subclass of StorageClass.registerStorageClass(storageClass)Store the StorageClassin the factory.Methods Documentation
-
addFromConfig(config: Union[lsst.daf.butler.core.storageClass.StorageClassConfig, lsst.daf.butler.core.config.Config, str]) → None¶ Add more
StorageClassdefinitions from a config file.Parameters: - config :
StorageClassConfig,Configorstr Storage class configuration. Can contain a
storageClasseskey if part of a global configuration.
- config :
-
getStorageClass(storageClassName: str) → lsst.daf.butler.core.storageClass.StorageClass¶ Get a StorageClass instance associated with the supplied name.
Parameters: - storageClassName :
str Name of the storage class to retrieve.
Returns: - instance :
StorageClass Instance of the correct
StorageClass.
Raises: - KeyError
The requested storage class name is not registered.
- storageClassName :
-
static
makeNewStorageClass(name: str, baseClass: Optional[Type[lsst.daf.butler.core.storageClass.StorageClass]] = <class 'lsst.daf.butler.core.storageClass.StorageClass'>, **kwargs) → Type[lsst.daf.butler.core.storageClass.StorageClass]¶ Create a new Python class as a subclass of
StorageClass.Parameters: - name :
str Name to use for this class.
- baseClass :
type, optional Base class for this
StorageClass. Must be eitherStorageClassor a subclass ofStorageClass. IfNone,StorageClasswill be used.
Returns: - newtype :
typesubclass ofStorageClass Newly created Python type.
- name :
-
registerStorageClass(storageClass: lsst.daf.butler.core.storageClass.StorageClass) → None¶ Store the
StorageClassin the factory.Will be indexed by
StorageClass.nameand will return instances of the suppliedStorageClass.Parameters: - storageClass :
StorageClass Type of the Python
StorageClassto register.
Raises: - ValueError
If a storage class has already been registered with storageClassName and the previous definition differs.
- storageClass :
- config :