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

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

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

Variable Documentation

◆ specialImportRegistry

Mixins.specialImportRegistry

Definition at line 54 of file Mixins.py.