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

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

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

Variable Documentation

◆ specialImportRegistry

Mixins.specialImportRegistry

Definition at line 53 of file Mixins.py.