Skip to content

Commit 295d06e

Browse files
authored
Bump jsonschema to 4.24.* (#14166)
1 parent ad38f75 commit 295d06e

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

stubs/jsonschema/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "4.23.*"
1+
version = "4.24.*"
22
upstream_repository = "https://github.com/python-jsonschema/jsonschema"
33
requires = ["referencing"]
44
partial_stub = true

stubs/jsonschema/jsonschema/_utils.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from _typeshed import Incomplete, SupportsKeysAndGetItem
1+
from _typeshed import Incomplete, SupportsKeysAndGetItem, SupportsNext
22
from collections.abc import Generator, Iterable, Iterator, Mapping, MutableMapping, Sized
33

44
class URIDict(MutableMapping[str, str]):
@@ -24,3 +24,4 @@ def unbool(element, true=..., false=...): ...
2424
def uniq(container) -> bool: ...
2525
def find_evaluated_item_indexes_by_schema(validator, instance, schema) -> list[Incomplete]: ...
2626
def find_evaluated_property_keys_by_schema(validator, instance, schema) -> list[Incomplete]: ...
27+
def is_valid(errs_it: SupportsNext[object]) -> bool: ...

stubs/jsonschema/jsonschema/validators.pyi

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from _typeshed import Incomplete, SupportsKeysAndGetItem
22
from collections.abc import Callable, Generator, Iterable, Iterator, Mapping
33
from contextlib import contextmanager
4-
from typing import Any, ClassVar
5-
from typing_extensions import TypeAlias
4+
from typing import Any, ClassVar, overload
5+
from typing_extensions import TypeAlias, deprecated
66

77
from referencing.jsonschema import Schema, SchemaRegistry
88
from referencing.typing import URI
@@ -11,6 +11,7 @@ from ._format import FormatChecker
1111
from ._types import TypeChecker
1212
from ._utils import Unset, URIDict
1313
from .exceptions import ValidationError
14+
from .protocols import Validator
1415

1516
# these type aliases do not exist at runtime, they're only defined here in the stub
1617
_JsonObject: TypeAlias = Mapping[str, Any]
@@ -40,15 +41,27 @@ class _Validator:
4041
@classmethod
4142
def check_schema(cls, schema: Schema, format_checker: FormatChecker | Unset = ...) -> None: ...
4243
@property
44+
@deprecated(
45+
"Accessing resolver() is deprecated as of v4.18.0, "
46+
"in favor of the https://github.com/python-jsonschema/referencing library."
47+
)
4348
def resolver(self): ...
4449
def evolve(self, **changes) -> _Validator: ...
45-
def iter_errors(self, instance, _schema: Schema | None = ...) -> Generator[Incomplete, None, None]: ...
50+
@overload
51+
def iter_errors(self, instance) -> Generator[Incomplete]: ...
52+
@overload
53+
@deprecated("Passing a schema to Validator.iter_errors is deprecated and will be removed in a future release.")
54+
def iter_errors(self, instance, _schema: Schema | None) -> Generator[Incomplete]: ...
4655
def descend(
4756
self, instance, schema: Schema, path: Incomplete | None = ..., schema_path: Incomplete | None = ..., resolver=None
4857
) -> Generator[Incomplete, None, None]: ...
4958
def validate(self, *args, **kwargs) -> None: ...
50-
def is_type(self, instance, type): ...
51-
def is_valid(self, instance, _schema: Schema | None = ...) -> bool: ...
59+
def is_type(self, instance, type) -> bool: ...
60+
@overload
61+
def is_valid(self, instance) -> bool: ...
62+
@overload
63+
@deprecated("Passing a schema to Validator.is_valid is deprecated and will be removed in a future release.")
64+
def is_valid(self, instance, _schema: Schema | None) -> bool: ...
5265

5366
def validates(version: str) -> Callable[..., Incomplete]: ...
5467
def create(
@@ -94,15 +107,16 @@ class RefResolver:
94107
@property
95108
def resolution_scope(self): ...
96109
@property
97-
def base_uri(self): ...
110+
def base_uri(self) -> str: ...
98111
@contextmanager
112+
@deprecated("jsonschema.RefResolver.in_scope is deprecated and will be removed in a future release.")
99113
def in_scope(self, scope) -> Generator[None]: ...
100114
@contextmanager
101-
def resolving(self, ref) -> Generator[Incomplete, None, None]: ...
102-
def resolve(self, ref): ...
103-
def resolve_from_url(self, url): ...
104-
def resolve_fragment(self, document, fragment): ...
105-
def resolve_remote(self, uri): ...
115+
def resolving(self, ref: str) -> Generator[Incomplete]: ...
116+
def resolve(self, ref: str) -> tuple[str, Incomplete]: ...
117+
def resolve_from_url(self, url: str): ...
118+
def resolve_fragment(self, document, fragment: str): ...
119+
def resolve_remote(self, uri: str): ...
106120

107121
def validate(instance: object, schema: Schema, cls: type[_Validator] | None = None, *args: Any, **kwargs: Any) -> None: ...
108-
def validator_for(schema: Schema | bool, default=...): ...
122+
def validator_for(schema: Schema | bool, default: type[Validator] | Unset = ...) -> type[Validator]: ...

0 commit comments

Comments
 (0)