From b2aaed1e68d961812e791e9ca1646f2736ed6e0b Mon Sep 17 00:00:00 2001 From: Stephen Rosen Date: Sun, 29 May 2022 17:22:34 -0400 Subject: [PATCH] Fix jsonschema exception str|int containers (#7981) 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 19ba3fc9d..62016a315 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