CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Mixins._SpecialImportRegistry Class Reference
Inheritance diagram for Mixins._SpecialImportRegistry:

Public Member Functions

def __init__ (self)
 
def getSpecialImports (self)
 
def registerSpecialImportForType (self, cls, impStatement)
 
def registerUse (self, obj)
 

Private Member Functions

def _reset (self)
 

Private Attributes

 _registry
 

Detailed Description

This class collects special import statements of configuration types

Definition at line 25 of file Mixins.py.

Constructor & Destructor Documentation

◆ __init__()

def Mixins._SpecialImportRegistry.__init__ (   self)

Definition at line 27 of file Mixins.py.

27  def __init__(self):
28  self._registry = {}
29 

Member Function Documentation

◆ _reset()

def Mixins._SpecialImportRegistry._reset (   self)
private

Definition at line 30 of file Mixins.py.

30  def _reset(self):
31  for lst in six.itervalues(self._registry):
32  lst[1] = False
33 

References Mixins._SpecialImportRegistry._registry.

◆ getSpecialImports()

def Mixins._SpecialImportRegistry.getSpecialImports (   self)

Definition at line 47 of file Mixins.py.

47  def getSpecialImports(self):
48  coll = set()
49  for (imp, used) in six.itervalues(self._registry):
50  if used:
51  coll.add(imp)
52  return sorted(coll)
53 

References Mixins._SpecialImportRegistry._registry.

◆ registerSpecialImportForType()

def Mixins._SpecialImportRegistry.registerSpecialImportForType (   self,
  cls,
  impStatement 
)

Definition at line 34 of file Mixins.py.

34  def registerSpecialImportForType(self, cls, impStatement):
35  className = cls.__name__
36  if className in self._registry:
37  raise RuntimeError("Error: the configuration type '%s' already has an import statement registered '%s'" % (className, self._registry[className][0]))
38  self._registry[className] = [impStatement, False]
39 

References Types._Untracked.__name__, and Mixins._SpecialImportRegistry._registry.

◆ registerUse()

def Mixins._SpecialImportRegistry.registerUse (   self,
  obj 
)

Definition at line 40 of file Mixins.py.

40  def registerUse(self, obj):
41  className = obj.__class__.__name__
42  try:
43  self._registry[className][1] = True
44  except KeyError:
45  pass
46 

References Mixins._SpecialImportRegistry._registry.

Member Data Documentation

◆ _registry

Mixins._SpecialImportRegistry._registry
private