LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Static Private Member Functions | List of all members
lsst.pipe.tasks.mocks.simpleMapper.MapperMeta Class Reference
Inheritance diagram for lsst.pipe.tasks.mocks.simpleMapper.MapperMeta:

Public Member Functions

def __init__
 

Static Private Member Functions

def _makeMapClosure
 
def _makeQueryClosure
 

Detailed Description

Metaclass for SimpleMapper that creates map_ and query_ methods for everything found in the
'mappings' class variable.

Definition at line 185 of file simpleMapper.py.

Constructor & Destructor Documentation

def lsst.pipe.tasks.mocks.simpleMapper.MapperMeta.__init__ (   cls,
  name,
  bases,
  dict_ 
)

Definition at line 202 of file simpleMapper.py.

203  def __init__(cls, name, bases, dict_):
204  type.__init__(cls, name, bases, dict_)
205  cls.keyDict = dict()
206  for dataset, mapping in cls.mappings.iteritems():
207  setattr(cls, "map_" + dataset, MapperMeta._makeMapClosure(dataset, mapping, suffix=None))
208  for suffix in mapping.persistence.suffixes:
209  setattr(cls, "map_" + dataset + suffix,
210  MapperMeta._makeMapClosure(dataset, mapping, suffix=suffix))
211  if hasattr(mapping, "query"):
212  setattr(cls, "query_" + dataset, MapperMeta._makeQueryClosure(dataset, mapping))
213  cls.keyDict.update(mapping.keys)

Member Function Documentation

def lsst.pipe.tasks.mocks.simpleMapper.MapperMeta._makeMapClosure (   dataset,
  mapping,
  suffix = None 
)
staticprivate

Definition at line 191 of file simpleMapper.py.

192  def _makeMapClosure(dataset, mapping, suffix=None):
193  def mapClosure(self, dataId, write=False):
194  return mapping.map(dataset, self.root, dataId, suffix=suffix)
195  return mapClosure
def lsst.pipe.tasks.mocks.simpleMapper.MapperMeta._makeQueryClosure (   dataset,
  mapping 
)
staticprivate

Definition at line 197 of file simpleMapper.py.

198  def _makeQueryClosure(dataset, mapping):
199  def queryClosure(self, level, format, dataId):
200  return mapping.query(self.index, level, format, dataId)
201  return queryClosure

The documentation for this class was generated from the following file: