CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Attributes
genericValidation.ValidationMetaClass Class Reference
Inheritance diagram for genericValidation.ValidationMetaClass:
genericValidation.GenericValidation genericValidation.GenericValidationData genericValidation.ParallelValidation genericValidation.ValidationWithComparison genericValidation.ValidationWithPlots genericValidation.GenericValidationData_CTSR genericValidation.ValidationForPresentation genericValidation.ValidationWithPlotsSummaryBase genericValidation.ValidationWithPlotsSummary

Public Member Functions

def __new__
 

Static Public Attributes

list dicts = ["defaults"]
 
list sets = ["mandatories", "optionals", "needpackages"]
 

Detailed Description

Definition at line 14 of file genericValidation.py.

Member Function Documentation

def genericValidation.ValidationMetaClass.__new__ (   cls,
  clsname,
  bases,
  dct 
)

Definition at line 17 of file genericValidation.py.

References update.

Referenced by SequenceTypes._ModuleSequenceType.copyAndExclude().

17 
18  def __new__(cls, clsname, bases, dct):
19  for setname in cls.sets:
20  if setname not in dct: dct[setname] = set()
21  dct[setname] = set.union(dct[setname], *(getattr(base, setname) for base in bases if hasattr(base, setname)))
22 
23  for dictname in cls.dicts:
24  if dictname not in dct: dct[dictname] = {}
25  for base in bases:
26  if not hasattr(base, dictname): continue
27  newdict = getattr(base, dictname)
28  for key in set(newdict) & set(dct[dictname]):
29  if newdict[key] != dct[dictname][key]:
30  raise ValueError("Inconsistent values of defaults[{}]: {}, {}".format(key, newdict[key], dct[dictname][key]))
31  dct[dictname].update(newdict)
32 
33  for setname in cls.sets: #e.g. removemandatories, used in preexistingvalidation
34  #use with caution
35  if "remove"+setname not in dct: dct["remove"+setname] = set()
36  dct["remove"+setname] = set.union(dct["remove"+setname], *(getattr(base, "remove"+setname) for base in bases if hasattr(base, "remove"+setname)))
37 
38  dct[setname] -= dct["remove"+setname]
39 
40  return super(ValidationMetaClass, cls).__new__(cls, clsname, bases, dct)
#define update(a, b)

Member Data Documentation

list genericValidation.ValidationMetaClass.dicts = ["defaults"]
static

Definition at line 16 of file genericValidation.py.

list genericValidation.ValidationMetaClass.sets = ["mandatories", "optionals", "needpackages"]
static

Definition at line 15 of file genericValidation.py.