CMS 3D CMS Logo

Functions
utilities Namespace Reference

Functions

def cache (function)
 

Function Documentation

def utilities.cache (   function)

Definition at line 3 of file utilities.py.

References edm.print().

Referenced by EcalHitResponse.analogSignalAmplitude(), SiStripLAProfileBooker.analyze(), DTCalibrationMap.getConsts(), ConvBremPFTrackFinder.getConvBremPFRecTracks(), edm::RootTree.getEntry(), BeamConditionsMonitor.globalBeginLuminosityBlock(), RectangularEtaPhiTrackingRegion.hits(), CosmicTrackingRegion.hits_(), DeepFlavourTFJetTagsProducer.initializeGlobalCache(), DeepDoubleXTFJetTagsProducer.initializeGlobalCache(), DeepBoostedJetTagsProducer.initializeGlobalCache(), trackMVAClassifierImpl::ComputeMVA< EventCache >.operator()(), PhysicsTools::MVAModuleHelper< Record, Object, Filler >.operator()(), ClusterShapeTrackFilterProducer.produce(), HIPixelTrackFilterProducer.produce(), SiPixelDigiToRaw.produce(), edm::PtrVectorBase.PtrVectorBase(), edm::RootEmbeddedFileSequence.readOneEvent(), edm::RootFile.RootFile(), edm::EmbeddedRootSource.runHelper(), ClusterShapeTrajectoryFilter.setEvent(), PhysicsTools::MVAModuleHelper< Record, Object, Filler >.setEventSetup(), PhysicsTools::MVAModuleHelper< Record, Object, Filler >.train(), edm::refcoreimpl.tryToSetCacheItemForFirstTime(), and reco::FlavorHistoryEvent.~FlavorHistoryEvent().

3 def cache(function):
4  cache = {}
5  def newfunction(*args, **kwargs):
6  try:
7  return cache[args, tuple(sorted(kwargs.iteritems()))]
8  except TypeError:
9  print(args, tuple(sorted(kwargs.iteritems())))
10  raise
11  except KeyError:
12  cache[args, tuple(sorted(kwargs.iteritems()))] = function(*args, **kwargs)
13  return newfunction(*args, **kwargs)
14  newfunction.__name__ = function.__name__
15  return newfunction
16 
Definition: vlib.h:256
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def cache(function)
Definition: utilities.py:3