CMS 3D CMS Logo

Classes | Functions | Variables
Mixins Namespace Reference

Classes

class  _ConfigureComponent
 
class  _Labelable
 
class  _Parameterizable
 
class  _ParameterTypeBase
 
class  _SimpleParameterTypeBase
 
class  _SpecialImportRegistry
 
class  _TypedParameterizable
 
class  _Unlabelable
 
class  _ValidatingListBase
 
class  _ValidatingParameterListBase
 
class  PrintOptions
 
class  TestList
 
class  testMixins
 
class  UsingBlock
 

Functions

def _modifyParametersFromDict (params, newParams, errorRaiser, keyDepth="")
 
def saveOrigin (obj, level)
 

Variables

 specialImportRegistry
 

Function Documentation

◆ _modifyParametersFromDict()

def Mixins._modifyParametersFromDict (   params,
  newParams,
  errorRaiser,
  keyDepth = "" 
)
private

Definition at line 688 of file Mixins.py.

688 def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth=""):
689  if len(newParams):
690  #need to treat items both in params and myparams specially
691  for key,value in six.iteritems(newParams):
692  if key in params:
693  if value is None:
694  del params[key]
695  elif isinstance(value, dict):
696  if isinstance(params[key],_Parameterizable):
697  pset = params[key]
698  p =pset.parameters_()
699  oldkeys = set(p.keys())
701  value,errorRaiser,
702  ("%s.%s" if isinstance(key, str) else "%s[%s]")%(keyDepth,key))
703  for k,v in six.iteritems(p):
704  setattr(pset,k,v)
705  oldkeys.discard(k)
706  for k in oldkeys:
707  delattr(pset,k)
708  elif isinstance(params[key],_ValidatingParameterListBase):
709  if any(not isinstance(k, int) for k in value.keys()):
710  raise TypeError("Attempted to change a list using a dict whose keys are not integers")
711  plist = params[key]
712  if any((k < 0 or k >= len(plist)) for k in value.keys()):
713  raise IndexError("Attempted to set an index which is not in the list")
714  p = dict(enumerate(plist))
716  value,errorRaiser,
717  ("%s.%s" if isinstance(key, str) else "%s[%s]")%(keyDepth,key))
718  for k,v in six.iteritems(p):
719  plist[k] = v
720  else:
721  raise ValueError("Attempted to change non PSet value "+keyDepth+" using a dictionary")
722  elif isinstance(value,_ParameterTypeBase) or (isinstance(key, int)) or isinstance(value, _Parameterizable):
723  params[key] = value
724  else:
725  params[key].setValue(value)
726  else:
727  if isinstance(value,_ParameterTypeBase) or isinstance(value, _Parameterizable):
728  params[key]=value
729  else:
730  errorRaiser(key)
731 
732 

References any(), and reco::JetExtendedAssociation.setValue().

Referenced by Config._ParameterModifier.__call__(), Mixins._TypedParameterizable.clone(), Types.PSet.clone(), and Types.EDAlias.clone().

◆ saveOrigin()

def Mixins.saveOrigin (   obj,
  level 
)

Definition at line 682 of file Mixins.py.

682 def saveOrigin(obj, level):
683  import sys
684  fInfo = inspect.getframeinfo(sys._getframe(level+1))
685  obj._filename = fInfo.filename
686  obj._lineNumber =fInfo.lineno
687 

Referenced by Modules.ESSource.__init__(), Modules._Module.__init__(), Mixins._TypedParameterizable.__init__(), Modules.SwitchProducer.clone(), Mixins._TypedParameterizable.clone(), and Types.EDAlias.clone().

Variable Documentation

◆ specialImportRegistry

Mixins.specialImportRegistry

Definition at line 54 of file Mixins.py.

reco::JetExtendedAssociation::setValue
bool setValue(Container &, const reco::JetBaseRef &, const JetExtendedData &)
associate jet with value. Returns false and associate nothing if jet is already associated
Definition: JetExtendedAssociation.cc:44
any
bool any(const std::vector< T > &v, const T &what)
Definition: ECalSD.cc:34
Mixins.saveOrigin
def saveOrigin(obj, level)
Definition: Mixins.py:682
Mixins._modifyParametersFromDict
def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth="")
Definition: Mixins.py:688