Skip to content

Commit

Permalink
Adds suggestions
Browse files Browse the repository at this point in the history
Co-authored-by: Julian Berman <[email protected]>
  • Loading branch information
hbcarlos and Julian committed Jul 28, 2023
1 parent cd9d91c commit b188462
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions jupyter_events/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from typing import Optional, Type, Union

from jsonschema import FormatChecker, validators
from referencing import Registry
from referencing import Registry, Resource
from referencing.jsonschema import DRAFT7

try:
Expand Down Expand Up @@ -74,7 +74,7 @@ def __init__(
validate_schema(_schema)

if registry is None:
registry = Registry().with_resource(_schema["$id"], DRAFT7.create_resource(_schema))
registry = DRAFT7.create_resource(_schema) @ Registry()

# Create a validator for this schema
self._validator = validator_class(_schema, registry=registry, format_checker=format_checker) # type: ignore
Expand Down
9 changes: 2 additions & 7 deletions jupyter_events/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,8 @@
EVENT_CORE_SCHEMA["$id"]: EVENT_CORE_SCHEMA,
}

METASCHEMA_REGISTRY = Registry().with_resources( # type:ignore
[
(EVENT_METASCHEMA["$id"], DRAFT7.create_resource(EVENT_METASCHEMA)),
(PROPERTY_METASCHEMA["$id"], DRAFT7.create_resource(PROPERTY_METASCHEMA)),
(EVENT_CORE_SCHEMA["$id"], DRAFT7.create_resource(EVENT_CORE_SCHEMA)),
]
)
resources = [DRAFT7.create_resource(each) for each in (EVENT_METASCHEMA, PROPERTY_METASCHEMA, EVENT_CORE_SCHEMA)]
METASCHEMA_REGISTRY = resources @ Registry()

JUPYTER_EVENTS_SCHEMA_VALIDATOR = Draft7Validator( # type: ignore
schema=EVENT_METASCHEMA,
Expand Down

0 comments on commit b188462

Please sign in to comment.