StorageClass¶
- 
class lsst.daf.butler.StorageClass(name: Optional[str, None] = None, pytype: Union[Type, str, None] = None, components: Optional[Dict[str, lsst.daf.butler.core.storageClass.StorageClass], None] = None, derivedComponents: Optional[Dict[str, lsst.daf.butler.core.storageClass.StorageClass], None] = None, parameters: Union[Sequence, Set, None] = None, delegate: Optional[str, None] = None, converters: Optional[Dict[str, str], None] = None)¶
- Bases: - object- Class describing how a label maps to a particular Python type. - Parameters: - name : str
- Name to use for this class. 
- pytype : typeorstr
- Python type (or name of type) to associate with the - StorageClass
- components : dict, optional
- dictmapping name of a component to another- StorageClass.
- derivedComponents : dict, optional
- dictmapping name of a derived component to another- StorageClass.
- parameters : SequenceorSet
- Parameters understood by this - StorageClassthat can control reading of data from datastores.
- delegate : str, optional
- Fully qualified name of class supporting assembly and disassembly of a - pytypeinstance.
- converters : dict[str,str], optional
- Mapping of python type to function that can be called to convert that python type to the valid type of this storage class. 
 - Attributes Summary - components- Return the components associated with this - StorageClass.- converters- Return the type converters supported by this - StorageClass.- converters_by_type- Return the type converters as python types. - defaultDelegateName- delegateClass- Class to use to delegate type-specific actions. - derivedComponents- Return derived components associated with - StorageClass.- parameters- Return - setof names of supported parameters.- pytype- Return Python type associated with this - StorageClass.- Methods Summary - allComponents()- Return all defined components. - can_convert(other)- Return - Trueif this storage class can convert python types in the other storage class.- coerce_type(incorrect)- Coerce the supplied incorrect instance to the python type associated with this - StorageClass.- delegate()- Return an instance of a storage class delegate. - filterParameters(parameters, Any], subset, …)- Filter out parameters that are not known to this - StorageClass.- isComposite()- Return Boolean indicating whether this is a composite or not. - knownParameters()- Return set of all parameters known to this - StorageClass.- validateInstance(instance)- Check that the supplied Python object has the expected Python type. - validateParameters(parameters, None] = None)- Check that the parameters are known to this - StorageClass.- Attributes Documentation - 
components¶
- Return the components associated with this - StorageClass.
 - 
converters¶
- Return the type converters supported by this - StorageClass.
 - 
converters_by_type¶
- Return the type converters as python types. 
 - 
defaultDelegateName= 'lsst.daf.butler.core.storageClassDelegate.StorageClassDelegate'¶
 - 
delegateClass¶
- Class to use to delegate type-specific actions. 
 - 
derivedComponents¶
- Return derived components associated with - StorageClass.
 - 
pytype¶
- Return Python type associated with this - StorageClass.
 - Methods Documentation - 
allComponents() → Mapping[str, lsst.daf.butler.core.storageClass.StorageClass]¶
- Return all defined components. - This mapping includes all the derived and read/write components for the corresponding storage class. - Returns: - comp : dictof [str,StorageClass]
- The component name to storage class mapping. 
 
- comp : 
 - 
can_convert(other: lsst.daf.butler.core.storageClass.StorageClass) → bool¶
- Return - Trueif this storage class can convert python types in the other storage class.- Parameters: - other : StorageClass
- The storage class to check. 
 - Returns: 
- other : 
 - 
coerce_type(incorrect: Any) → Any¶
- Coerce the supplied incorrect instance to the python type associated with this - StorageClass.- Parameters: - incorrect : object
- An object that might be the incorrect type. 
 - Returns: - correct : object
- An object that matches the python type of this - StorageClass. Can be the same object as given. If- None,- Nonewill be returned.
 - Raises: - TypeError
- Raised if no conversion can be found. 
 
- incorrect : 
 - 
delegate() → lsst.daf.butler.core.storageClassDelegate.StorageClassDelegate¶
- Return an instance of a storage class delegate. - Returns: - delegate : StorageClassDelegate
- Instance of the delegate associated with this - StorageClass. The delegate is constructed with this- StorageClass.
 - Raises: - TypeError
- This StorageClass has no associated delegate. 
 
- delegate : 
 - 
filterParameters(parameters: Mapping[str, Any], subset: Optional[Collection, None] = None) → Mapping[str, Any]¶
- Filter out parameters that are not known to this - StorageClass.- Parameters: - parameters : Mapping, optional
- Candidate parameters. Can be - Noneif no parameters have been provided.
- subset : Collection, optional
- Subset of supported parameters that the caller is interested in using. The subset must be known to the - StorageClassif specified. If- Nonethe supplied parameters will all be checked, else only the keys in this set will be checked.
 - Returns: - filtered : Mapping
- Valid parameters. Empty - dictif none are suitable.
 - Raises: - ValueError
- Raised if the provided subset is not a subset of the supported parameters or if it is an empty set. 
 
- parameters : 
 - 
isComposite() → bool¶
- Return Boolean indicating whether this is a composite or not. - Returns: - isComposite : bool
- Trueif this- StorageClassis a composite,- Falseotherwise.
 
- isComposite : 
 - 
knownParameters() → Set[str]¶
- Return set of all parameters known to this - StorageClass.- The set includes parameters understood by components of a composite. - Returns: - known : set
- All parameter keys of this - StorageClassand the component storage classes.
 
- known : 
 - 
validateInstance(instance: Any) → bool¶
- Check that the supplied Python object has the expected Python type. - Parameters: - instance : object
- Object to check. 
 - Returns: - isOk : bool
- True if the supplied instance object can be handled by this - StorageClass, False otherwise.
 
- instance : 
 - 
validateParameters(parameters: Optional[Collection, None] = None) → None¶
- Check that the parameters are known to this - StorageClass.- Does not check the values. - Parameters: - parameters : Collection, optional
- Collection containing the parameters. Can be - dict-like or- set-like. The parameter values are not checked. If no parameters are supplied, always returns without error.
 - Raises: - KeyError
- Some parameters are not understood by this - StorageClass.
 
- parameters : 
 
- name :