From 994ba98e427da414ac9a486d987f0b3e205b5ecb Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Sun, 29 May 2022 16:02:50 +0000 Subject: [PATCH] Fix jsonschema exception str|int containers schema_path, relative_schema_path, and absolute_schema_path are all (related) attributes of `jsonschema` errors which contain `str | int` but were accidentally annotated as containing `str`. Fix them for accuracy. --- stubs/jsonschema/jsonschema/exceptions.pyi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stubs/jsonschema/jsonschema/exceptions.pyi b/stubs/jsonschema/jsonschema/exceptions.pyi index 19ba3fc9d780..62016a315f25 100644 --- a/stubs/jsonschema/jsonschema/exceptions.pyi +++ b/stubs/jsonschema/jsonschema/exceptions.pyi @@ -14,8 +14,8 @@ class _Error(Exception): message: str path: deque[str | int] relative_path: deque[str | int] - schema_path: deque[str] - relative_schema_path: deque[str] + schema_path: deque[str | int] + relative_schema_path: deque[str | int] context: list[ValidationError] | None cause: Exception | None validator: protocols.Validator | None @@ -33,7 +33,7 @@ class _Error(Exception): validator_value=..., instance: Any = ..., schema: Any = ..., - schema_path: Sequence[str] = ..., + schema_path: Sequence[str | int] = ..., parent: _Error | None = ..., ) -> None: ... @classmethod @@ -41,7 +41,7 @@ class _Error(Exception): @property def absolute_path(self) -> Sequence[str | int]: ... @property - def absolute_schema_path(self) -> Sequence[str]: ... + def absolute_schema_path(self) -> Sequence[str | int]: ... @property def json_path(self) -> str: ... # TODO: this type could be made more precise using TypedDict to