Skip to content

Commit

Permalink
Fix deprecation warning when importing from jsonschema (#368)
Browse files Browse the repository at this point in the history
* Fix deprecation warning when importing from jsonschema

* lint

---------

Co-authored-by: Steven Silvester <[email protected]>
  • Loading branch information
eladkal and blink1073 authored Jul 7, 2023
1 parent 8cb2789 commit c348f9d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nbformat/json_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 11,7 @@
import jsonschema
from fastjsonschema import JsonSchemaException as _JsonSchemaException
from jsonschema import Draft4Validator as _JsonSchemaValidator
from jsonschema import ErrorTree, ValidationError
from jsonschema.exceptions import ErrorTree, ValidationError


class JsonSchemaValidator:
Expand Down Expand Up @@ -55,7 55,7 @@ def __init__(self, schema):
def validate(self, data):
"""Validate incoming data."""
try:
self._validator(data)
self._validator(data) # type:ignore[operator]
except _JsonSchemaException as error:
raise ValidationError(str(error), schema_path=error.path) from error

Expand All @@ -67,7 67,7 @@ def iter_errors(self, data, schema=None):
errors = []
validate_func = self._validator
try:
validate_func(data)
validate_func(data) # type:ignore[operator]
except _JsonSchemaException as error:
errors = [ValidationError(str(error), schema_path=error.path)]

Expand Down

0 comments on commit c348f9d

Please sign in to comment.