Skip to content

Commit

Permalink
Remove references to Unset in the typing annotations.
Browse files Browse the repository at this point in the history
I don't want them appearing in public documentation. The public types of
these arguments do not include Unset, a user may only pass them the
declared type, even though internally the type is larger.

Refs: #1019 (comment)
  • Loading branch information
Julian committed Jun 5, 2024
1 parent 0151efd commit 0024b58
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions jsonschema/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ class _Error(Exception):
def __init__(
self,
message: str,
validator: str | _utils.Unset = _unset,
validator: str = _unset, # type: ignore[assignment]
path: Iterable[str | int] = (),
cause: Exception | None = None,
context=(),
validator_value: Any = _unset,
instance: Any = _unset,
schema: Mapping[str, Any] | bool | _utils.Unset = _unset,
schema: Mapping[str, Any] | bool = _unset, # type: ignore[assignment]
schema_path: Iterable[str | int] = (),
parent: _Error | None = None,
type_checker: _types.TypeChecker | _utils.Unset = _unset,
type_checker: _types.TypeChecker = _unset, # type: ignore[assignment]
) -> None:
super().__init__(
message,
Expand Down Expand Up @@ -176,9 +176,6 @@ def _matches_type(self) -> bool:
except (KeyError, TypeError):
return False

if isinstance(self._type_checker, _utils.Unset):
return False

if isinstance(expected, str):
return self._type_checker.is_type(self.instance, expected)

Expand Down

0 comments on commit 0024b58

Please sign in to comment.