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

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

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

695 def saveOrigin(obj, level):
696  import sys
697  fInfo = inspect.getframeinfo(sys._getframe(level+1))
698  obj._filename = fInfo.filename
699  obj._lineNumber =fInfo.lineno
700 

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:38
Mixins.saveOrigin
def saveOrigin(obj, level)
Definition: Mixins.py:695
Mixins._modifyParametersFromDict
def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth="")
Definition: Mixins.py:701