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

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

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

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

◆ saveOrigin()

def Mixins.saveOrigin (   obj,
  level 
)

Definition at line 701 of file Mixins.py.

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

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

Variable Documentation

◆ specialImportRegistry

Mixins.specialImportRegistry

Definition at line 53 of file Mixins.py.