StorageClass

class lsst.daf.butler.StorageClass(name=None, pytype=None, components=None, assembler=None)

Bases: object

Class describing how a label maps to a particular Python type.

Parameters:
name : str

Name to use for this class.

pytype : type

Python type (or name of type) to associate with the StorageClass

components : dict, optional

dict mapping name of a component to another StorageClass.

assembler : str, optional

Fully qualified name of class supporting assembly and disassembly of a pytype instance.

Attributes Summary

assemblerClass Class to use to (dis)assemble an object from components.
components Component names mapped to associated StorageClass
defaultAssemblerName
pytype Python type associated with this StorageClass.

Methods Summary

assembler() Return an instance of an assembler.
isComposite() Boolean indicating whether this StorageClass is a composite or not.
validateInstance(instance) Check that the supplied Python object has the expected Python type

Attributes Documentation

assemblerClass

Class to use to (dis)assemble an object from components.

components

Component names mapped to associated StorageClass

defaultAssemblerName = 'lsst.daf.butler.core.assembler.CompositeAssembler'
pytype

Python type associated with this StorageClass.

Methods Documentation

assembler()

Return an instance of an assembler.

Returns:
assembler : CompositeAssembler

Instance of the assembler associated with this StorageClass. Assembler is constructed with this StorageClass.

Raises:
TypeError

This StorageClass has no associated assembler.

isComposite()

Boolean indicating whether this StorageClass is a composite or not.

Returns:
isComposite : bool

True if this StorageClass is a composite, False otherwise.

validateInstance(instance)

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.