mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 16:24:40 +04:00
Add error_handler and use it.
This commit is contained in:
parent
e3d29a897b
commit
9a017dcbe9
8 changed files with 177 additions and 35 deletions
|
|
@ -20,20 +20,20 @@ def extend_validator_cls(validator_cls, modify):
|
|||
|
||||
|
||||
def default_values(properties, instance):
|
||||
for property, subschema in properties.items():
|
||||
for prop, subschema in properties.items():
|
||||
if 'default' in subschema:
|
||||
instance.setdefault(
|
||||
property, copy.deepcopy(subschema['default']),
|
||||
prop, copy.deepcopy(subschema['default']),
|
||||
)
|
||||
|
||||
|
||||
def remove_default_values(properties, instance):
|
||||
for property, subschema in properties.items():
|
||||
for prop, subschema in properties.items():
|
||||
if (
|
||||
'default' in subschema and
|
||||
instance.get(property) == subschema['default']
|
||||
'default' in subschema and
|
||||
instance.get(prop) == subschema['default']
|
||||
):
|
||||
del instance[property]
|
||||
del instance[prop]
|
||||
|
||||
|
||||
_AddDefaultsValidator = extend_validator_cls(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue