From 6184f85126f07c49834fc51eef325e240fdb497c Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Tue, 9 Jul 2024 13:59:10 +0200 Subject: [PATCH 1/2] [jsonschema] Update to 4.23.* --- stubs/jsonschema/METADATA.toml | 2 +- stubs/jsonschema/jsonschema/_format.pyi | 1 - stubs/jsonschema/jsonschema/exceptions.pyi | 28 ++++++++++++---------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/stubs/jsonschema/METADATA.toml b/stubs/jsonschema/METADATA.toml index a523ab6cbf4f..a4fabbc736b5 100644 --- a/stubs/jsonschema/METADATA.toml +++ b/stubs/jsonschema/METADATA.toml @@ -1,4 +1,4 @@ -version = "4.22.*" +version = "4.23.*" upstream_repository = "https://github.com/python-jsonschema/jsonschema" requires = ["referencing"] partial_stub = true diff --git a/stubs/jsonschema/jsonschema/_format.pyi b/stubs/jsonschema/jsonschema/_format.pyi index fd4615fa71ab..8b9912dc59ac 100644 --- a/stubs/jsonschema/jsonschema/_format.pyi +++ b/stubs/jsonschema/jsonschema/_format.pyi @@ -39,7 +39,6 @@ def is_time(instance: object) -> bool: ... def is_regex(instance: object) -> bool: ... def is_date(instance: object) -> bool: ... def is_draft3_time(instance: object) -> bool: ... -def is_css_color_code(instance: object) -> bool: ... def is_css21_color(instance: object) -> bool: ... def is_json_pointer(instance: object) -> bool: ... def is_relative_json_pointer(instance: object) -> bool: ... diff --git a/stubs/jsonschema/jsonschema/exceptions.pyi b/stubs/jsonschema/jsonschema/exceptions.pyi index abd193d3fc5d..78da88a229e8 100644 --- a/stubs/jsonschema/jsonschema/exceptions.pyi +++ b/stubs/jsonschema/jsonschema/exceptions.pyi @@ -1,10 +1,12 @@ -from _typeshed import Incomplete, SupportsRichComparison +from _typeshed import Incomplete, SupportsRichComparison, sentinel from collections import deque -from collections.abc import Callable, Container, Iterable, Iterator, MutableMapping, Sequence +from collections.abc import Callable, Container, Iterable, Iterator, Mapping, MutableMapping, Sequence +from typing import Any from typing_extensions import Self, TypeAlias, deprecated -from jsonschema import _utils, protocols -from jsonschema._types import TypeChecker +from ._types import TypeChecker +from ._utils import Unset +from .protocols import Validator _RelevanceFuncType: TypeAlias = Callable[[ValidationError], SupportsRichComparison] @@ -19,7 +21,7 @@ class _Error(Exception): relative_schema_path: deque[str | int] context: list[ValidationError] | None cause: Exception | None - validator: protocols.Validator | None + validator: Validator | None validator_value: Incomplete instance: Incomplete schema: Incomplete @@ -27,16 +29,16 @@ class _Error(Exception): def __init__( self, message: str, - validator: _utils.Unset | None | protocols.Validator = ..., - path: Sequence[str | int] = (), - cause: Incomplete | None = None, + validator: str | Unset = sentinel, + path: Iterable[str | int] = (), + cause: Exception | None = None, context: Sequence[ValidationError] = (), - validator_value=..., - instance=..., - schema=..., - schema_path: Sequence[str | int] = (), + validator_value: Any | Unset = sentinel, + instance: Any | Unset = sentinel, + schema: Mapping[str, Any] | bool | Unset = sentinel, + schema_path: Iterable[str | int] = (), parent: _Error | None = None, - type_checker: _utils.Unset | TypeChecker = ..., + type_checker: TypeChecker | Unset = sentinel, ) -> None: ... @classmethod def create_from(cls, other: _Error) -> Self: ... From 5a7f8339c02a69e9c6562c865c60004f0955aee4 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Tue, 9 Jul 2024 14:07:23 +0200 Subject: [PATCH 2/2] Annotate `_Error` attributes --- 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 78da88a229e8..b92391c306c9 100644 --- a/stubs/jsonschema/jsonschema/exceptions.pyi +++ b/stubs/jsonschema/jsonschema/exceptions.pyi @@ -21,10 +21,10 @@ class _Error(Exception): relative_schema_path: deque[str | int] context: list[ValidationError] | None cause: Exception | None - validator: Validator | None - validator_value: Incomplete - instance: Incomplete - schema: Incomplete + validator: Validator | Unset + validator_value: Any | Unset + instance: Any | Unset + schema: Mapping[str, Any] | bool | Unset parent: _Error | None def __init__( self,