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 708 of file Mixins.py.

708 def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth=""):
709  if len(newParams):
710  #need to treat items both in params and myparams specially
711  for key,value in newParams.items():
712  if key in params:
713  if value is None:
714  del params[key]
715  elif isinstance(value, dict):
716  if isinstance(params[key],_Parameterizable):
717  pset = params[key]
718  p =pset.parameters_()
719  oldkeys = set(p.keys())
721  value,errorRaiser,
722  ("%s.%s" if isinstance(key, str) else "%s[%s]")%(keyDepth,key))
723  for k,v in p.items():
724  setattr(pset,k,v)
725  oldkeys.discard(k)
726  for k in oldkeys:
727  delattr(pset,k)
728  elif isinstance(params[key],_ValidatingParameterListBase):
729  if any(not isinstance(k, int) for k in value.keys()):
730  raise TypeError("Attempted to change a list using a dict whose keys are not integers")
731  plist = params[key]
732  if any((k < 0 or k >= len(plist)) for k in value.keys()):
733  raise IndexError("Attempted to set an index which is not in the list")
734  p = dict(enumerate(plist))
736  value,errorRaiser,
737  ("%s.%s" if isinstance(key, str) else "%s[%s]")%(keyDepth,key))
738  for k,v in p.items():
739  plist[k] = v
740  else:
741  raise ValueError("Attempted to change non PSet value "+keyDepth+" using a dictionary")
742  elif isinstance(value,_ParameterTypeBase) or (isinstance(key, int)) or isinstance(value, _Parameterizable):
743  params[key] = value
744  else:
745  params[key].setValue(value)
746  else:
747  if isinstance(value,_ParameterTypeBase) or isinstance(value, _Parameterizable):
748  params[key]=value
749  else:
750  errorRaiser(key)
751 
752 

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 702 of file Mixins.py.

702 def saveOrigin(obj, level):
703  import sys
704  fInfo = inspect.getframeinfo(sys._getframe(level+1))
705  obj._filename = fInfo.filename
706  obj._lineNumber =fInfo.lineno
707 

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 53 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:37
Mixins.saveOrigin
def saveOrigin(obj, level)
Definition: Mixins.py:702
Mixins._modifyParametersFromDict
def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth="")
Definition: Mixins.py:708