simplify consistency validation

reorder function (logical order)
remove duplicate arity (context, config_bag, option_bag, ...)
master cannot have length lower than slave length
This commit is contained in:
2018-09-16 11:40:54 +02:00
parent 1d6e0c0dcd
commit b31a94e449
2 changed files with 317 additions and 337 deletions

View File

@ -165,6 +165,8 @@ class OptionBag:
kwargs = {}
option_bag = OptionBag()
for key in self.__slots__:
if key == 'properties' and self.config_bag is undefined:
continue
setattr(option_bag, key, getattr(self, key))
return option_bag
@ -188,6 +190,9 @@ class ConfigBag:
return self.permissives
raise KeyError('unknown key {} for ConfigBag'.format(key)) # pragma: no cover
def remove_warnings(self):
self.properties = frozenset(self.properties - {'warnings'})
def remove_validation(self):
self.properties = frozenset(self.properties - {'validator'})