From 7f0f5e006e8727dd1fd0095df5feecf6c79c596b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Thu, 22 Dec 2022 09:35:57 +0100 Subject: [PATCH] Add typing and check to ``_Error.__init__`` --- jsonschema/exceptions.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/jsonschema/exceptions.py b/jsonschema/exceptions.py index 66ab97e2..bb3643ef 100644 --- a/jsonschema/exceptions.py +++ b/jsonschema/exceptions.py @@ -4,6 +4,7 @@ from __future__ import annotations from collections import defaultdict, deque +from collections.abc import Iterable, Mapping from pprint import pformat from textwrap import dedent, indent from typing import TYPE_CHECKING, Any, ClassVar @@ -31,17 +32,17 @@ class _Error(Exception): def __init__( self, message: str, - validator=_unset, - path=(), - cause=None, + validator: str | _utils.Unset = _unset, + path: Iterable[str | int] = (), + cause: Exception | None = None, context=(), validator_value=_unset, - instance=_unset, - schema=_unset, - schema_path=(), - parent=None, - type_checker=_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, + ) -> None: super(_Error, self).__init__( message, validator,