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 Jan 21, 2023
1 parent d2b558f commit fcd253a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion asdf/tests/test_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def test_extension_proxy():
with pytest.raises(TypeError):
ExtensionProxy(FullExtension(validators=[object()]))

# Unparseable ASDF Standard requirement:
# Unparsable ASDF Standard requirement:
with pytest.raises(ValueError):
ExtensionProxy(FullExtension(asdf_standard_requirement="asdf-standard >= 1.4.0"))

Expand Down
2 changes: 1 addition & 1 deletion asdf/tests/test_versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def test_spec_equal():
assert spec != "1.1.0"
assert spec != "1.1.0"
assert spec == "1.3.0"
assert "1.3.0" == spec # noqa: SIM300
assert spec == "1.3.0"

assert spec != (1, 1, 0)
assert (1, 1, 0) != spec
Expand Down
5 changes: 4 additions & 1 deletion docs/asdf/extending/validators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ one required method:
`Validator.schema_property` - The schema property that triggers this
validator. The property need not be globally unique, but it should be
unique among the validators that apply to the tag(s), and must not
collide with any of the built-in JSON schema propeties (type, additionalProperties,
collide with any of the built-in JSON schema properties (type, additionalProperties,
etc).

`Validator.tags` - a list of tag URIs or URI patterns handled by the validator.
Expand All @@ -46,6 +46,7 @@ The schema property will be called ``max_area``, so our validator will look like
from asdf.extension import Validator
from asdf.exceptions import ValidationError
class MaxAreaValidator(Validator):
schema_property = "max_area"
tags = ["asdf://example.com/example-project/tags/rectangle-1.0.0"]
Expand All @@ -68,11 +69,13 @@ around it and install that extension:
import asdf
from asdf.extension import Extension
class ShapesExtension(Extension):
extension_uri = "asdf://example.com/shapes/extensions/shapes-1.0.0"
validators = [MaxAreaValidator()]
tags = ["asdf://example.com/shapes/tags/rectangle-1.0.0"]
asdf.get_config().add_extension(ShapesExtension())
Now we can include a ``max_area`` property in a schema and have it
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ tests = [
'tracker' = 'https://github.com/asdf-format/asdf/issues'

[project.entry-points]
'asdf.resource_mappings' = {asdf = 'asdf.core._integration:get_json_schema_resource_mappings'}
'asdf.extensions' = {asdf = 'asdf.core._integration:get_extensions'}
'asdf.resource_mappings' = {asdf = 'asdf.core._integration:get_json_schema_resource_mappings'}
asdf_extensions = {builtin = 'asdf.extension:BuiltinExtension'}
console_scripts = {asdftool = 'asdf.commands.main:main'}
pytest11 = {asdf_schema_tester = 'pytest_asdf.plugin'}
Expand Down

0 comments on commit fcd253a

Please sign in to comment.