|
def | __new__ (cls, clsname, bases, dct) |
|
|
list | dicts = ["defaults"] |
|
list | sets = ["mandatories", "optionals", "needpackages"] |
|
Definition at line 14 of file genericValidation.py.
◆ __new__()
def genericValidation.ValidationMetaClass.__new__ |
( |
|
cls, |
|
|
|
clsname, |
|
|
|
bases, |
|
|
|
dct |
|
) |
| |
Definition at line 17 of file genericValidation.py.
17 def __new__(cls, clsname, bases, dct):
18 for setname
in cls.sets:
19 if setname
not in dct: dct[setname] = set()
20 dct[setname] = set.union(dct[setname], *(getattr(base, setname)
for base
in bases
if hasattr(base, setname)))
22 for dictname
in cls.dicts:
23 if dictname
not in dct: dct[dictname] = {}
25 if not hasattr(base, dictname):
continue
26 newdict = getattr(base, dictname)
27 for key
in set(newdict) & set(dct[dictname]):
28 if newdict[key] != dct[dictname][key]:
29 raise ValueError(
"Inconsistent values of defaults[{}]: {}, {}".
format(key, newdict[key], dct[dictname][key]))
30 dct[dictname].
update(newdict)
32 for setname
in cls.sets:
34 if "remove"+setname
not in dct: dct[
"remove"+setname] = set()
35 dct[
"remove"+setname] = set.union(dct[
"remove"+setname], *(getattr(base,
"remove"+setname)
for base
in bases
if hasattr(base,
"remove"+setname)))
37 dct[setname] -= dct[
"remove"+setname]
39 return super(ValidationMetaClass, cls).__new__(cls, clsname, bases, dct)
References genericValidation.ValidationMetaClass.dicts, genericValidation.ValidationMetaClass.sets, and update.
Referenced by SequenceTypes._ModuleSequenceType.copyAndExclude().
◆ dicts
list genericValidation.ValidationMetaClass.dicts = ["defaults"] |
|
static |
◆ sets
list genericValidation.ValidationMetaClass.sets = ["mandatories", "optionals", "needpackages"] |
|
static |