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 713 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().

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

707 def saveOrigin(obj, level):
708  import sys
709  fInfo = inspect.getframeinfo(sys._getframe(level+1))
710  obj._filename = fInfo.filename
711  obj._lineNumber =fInfo.lineno
712 
def saveOrigin(obj, level)
Definition: Mixins.py:707

Variable Documentation

◆ specialImportRegistry

Mixins.specialImportRegistry

Definition at line 53 of file Mixins.py.