CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
def saveOrigin
 

Variables

tuple specialImportRegistry = _SpecialImportRegistry()
 

Function Documentation

def Mixins._modifyParametersFromDict (   params,
  newParams,
  errorRaiser,
  keyDepth = "" 
)
private

Definition at line 708 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().

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

Definition at line 702 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().

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

Variable Documentation

tuple Mixins.specialImportRegistry = _SpecialImportRegistry()

Definition at line 53 of file Mixins.py.