Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Mar 19, 2023
1 parent f7170f1 commit 43031bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions asdf/_tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,16 @@ def test_defaults():
t = {}

validator = schema._create_json_schema_validator_factory(schema.FILL_DEFAULTS).create(
s, schema._make_resolver(None)
s,
schema._make_resolver(None),
)
validator.validate(t)

assert t["a"] == 42

validator = schema._create_json_schema_validator_factory(schema.REMOVE_DEFAULTS).create(
s, schema._make_resolver(None)
s,
schema._make_resolver(None),
)
validator.validate(t)

Expand Down
7 changes: 4 additions & 3 deletions asdf/schema.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from contextlib import contextmanager
import copy
import datetime
import json
import warnings
from collections import OrderedDict
from collections.abc import Mapping
from contextlib import contextmanager
from functools import lru_cache
from numbers import Integral
from operator import methodcaller
Expand Down Expand Up @@ -492,7 +492,7 @@ def _iter_errors(self, instance, _schema=None):
try:
tag_schema = self._resolver.resolve(schema_uri)[1]
yield from self._json_schema_validator_factory.create(tag_schema, self._resolver).iter_errors(
node
node,
)
except RefResolutionError:
warnings.warn(f"Unable to locate schema file for '{tag}': '{schema_uri}'", AsdfWarning)
Expand Down Expand Up @@ -560,7 +560,8 @@ def get_validator(
resolver = _make_resolver(url_mapping)

json_schema_validator_factory = _create_json_schema_validator_factory(
validators=validators, visit_repeat_nodes=_visit_repeat_nodes
validators=validators,
visit_repeat_nodes=_visit_repeat_nodes,
)
return _Validator(
ctx=ctx,
Expand Down

0 comments on commit 43031bd

Please sign in to comment.