Skip to content

Commit

Permalink
Initial review
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielNoord committed Nov 28, 2022
1 parent c4a758c commit 6a16fcd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions jsonschema/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from __future__ import annotations

from collections import defaultdict, deque
from collections.abc import Iterable
from collections.abc import Iterable, Mapping
from pprint import pformat
from textwrap import dedent, indent
from typing import TYPE_CHECKING, Any
Expand Down Expand Up @@ -37,8 +37,8 @@ def __init__(
cause: Exception | None = None,
context=(),
validator_value=_unset,
instance: dict[str, Any] | _utils.Unset = _unset,
schema: dict[str, Any] | _utils.Unset = _unset,
instance: Any = _unset,
schema: Mapping[str, Any] | bool | _utils.Unset = _unset,
schema_path: Iterable[str | int] = (),
parent: _Error | None = None,
type_checker: _types.TypeChecker | _utils.Unset = _unset,
Expand Down Expand Up @@ -160,11 +160,8 @@ def _contents(self):
return dict((attr, getattr(self, attr)) for attr in attrs)

def _matches_type(self) -> bool:
if isinstance(self.schema, _utils.Unset):
return False

try:
expected = self.schema["type"]
expected = self.schema["type"] # type: ignore[index] # We crash if it's not a dict
except (KeyError, TypeError):
return False

Expand Down

0 comments on commit 6a16fcd

Please sign in to comment.