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 23 of file Mixins.py.

Constructor & Destructor Documentation

def Mixins._SpecialImportRegistry.__init__ (   self)

Definition at line 25 of file Mixins.py.

25  def __init__(self):
26  self._registry = {}
27 

Member Function Documentation

def Mixins._SpecialImportRegistry._reset (   self)
private

Definition at line 28 of file Mixins.py.

References Mixins._SpecialImportRegistry._registry.

28  def _reset(self):
29  for lst in six.itervalues(self._registry):
30  lst[1] = False
31 
def Mixins._SpecialImportRegistry.getSpecialImports (   self)

Definition at line 45 of file Mixins.py.

References Mixins._SpecialImportRegistry._registry.

45  def getSpecialImports(self):
46  coll = set()
47  for (imp, used) in six.itervalues(self._registry):
48  if used:
49  coll.add(imp)
50  return sorted(coll)
51 
def Mixins._SpecialImportRegistry.registerSpecialImportForType (   self,
  cls,
  impStatement 
)

Definition at line 32 of file Mixins.py.

References Mixins._SpecialImportRegistry._registry.

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

Definition at line 38 of file Mixins.py.

References Mixins._SpecialImportRegistry._registry.

38  def registerUse(self, obj):
39  className = obj.__class__.__name__
40  try:
41  self._registry[className][1] = True
42  except KeyError:
43  pass
44 
def registerUse(self, obj)
Definition: Mixins.py:38

Member Data Documentation

Mixins._SpecialImportRegistry._registry
private