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

729 def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth=""):
730  if len(newParams):
731  #need to treat items both in params and myparams specially
732  for key,value in newParams.items():
733  if key in params:
734  if value is None:
735  del params[key]
736  elif isinstance(value, dict):
737  if isinstance(params[key],_Parameterizable):
738  pset = params[key]
739  p =pset.parameters_()
740  oldkeys = set(p.keys())
742  value,errorRaiser,
743  ("%s.%s" if isinstance(key, str) else "%s[%s]")%(keyDepth,key))
744  for k,v in p.items():
745  setattr(pset,k,v)
746  oldkeys.discard(k)
747  for k in oldkeys:
748  delattr(pset,k)
749  elif isinstance(params[key],_ValidatingParameterListBase):
750  if any(not isinstance(k, int) for k in value.keys()):
751  raise TypeError("Attempted to change a list using a dict whose keys are not integers")
752  plist = params[key]
753  if any((k < 0 or k >= len(plist)) for k in value.keys()):
754  raise IndexError("Attempted to set an index which is not in the list")
755  p = dict(enumerate(plist))
757  value,errorRaiser,
758  ("%s.%s" if isinstance(key, str) else "%s[%s]")%(keyDepth,key))
759  for k,v in p.items():
760  plist[k] = v
761  else:
762  raise ValueError("Attempted to change non PSet value "+keyDepth+" using a dictionary")
763  elif isinstance(value,_ParameterTypeBase) or (isinstance(key, int)) or isinstance(value, _Parameterizable):
764  params[key] = value
765  else:
766  params[key].setValue(value)
767  else:
768  if isinstance(value,_ParameterTypeBase) or isinstance(value, _Parameterizable):
769  params[key]=value
770  else:
771  errorRaiser(key)
772 
773 
def _modifyParametersFromDict(params, newParams, errorRaiser, keyDepth="")
Definition: Mixins.py:729
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 723 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().

723 def saveOrigin(obj, level):
724  import sys
725  fInfo = inspect.getframeinfo(sys._getframe(level+1))
726  obj._filename = fInfo.filename
727  obj._lineNumber =fInfo.lineno
728 
def saveOrigin(obj, level)
Definition: Mixins.py:723

Variable Documentation

◆ specialImportRegistry

Mixins.specialImportRegistry

Definition at line 54 of file Mixins.py.