Bump jsonschema to 4.19.* (#10583)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Sebastian Rittau
2023-09-23 05:11:54 +02:00
committed by GitHub
parent 49b717ca52
commit 6ca7505af7
6 changed files with 48 additions and 20 deletions

View File

@@ -1,5 +1,6 @@
version = "4.17.*"
version = "4.19.*"
upstream_repository = "https://github.com/python-jsonschema/jsonschema"
requires = ["referencing"]
partial_stub = true
[tool.stubtest]

View File

@@ -0,0 +1,13 @@
from collections.abc import Callable, Iterable
from typing import Any, Protocol
from typing_extensions import TypeAlias
from jsonschema.protocols import Validator
from referencing.jsonschema import Schema
class SchemaKeywordValidator(Protocol):
def __call__(self, validator: Validator, value: Any, instance: Any, schema: Schema) -> None: ...
id_of: TypeAlias = Callable[[Schema], str | None] # noqa: Y042
ApplicableValidators: TypeAlias = Callable[[Schema], Iterable[tuple[str, Any]]]

View File

@@ -13,7 +13,6 @@ class URIDict(MutableMapping[str, str]):
class Unset: ...
def load_schema(name): ...
def format_as_index(container: str, indices) -> str: ...
def find_additional_properties(
instance: Iterable[Incomplete], schema: Mapping[Incomplete, Incomplete]

View File

@@ -4,6 +4,9 @@ from contextlib import contextmanager
from typing import Any, ClassVar
from typing_extensions import TypeAlias
from referencing.jsonschema import Schema, SchemaRegistry
from referencing.typing import URI
from ._format import FormatChecker
from ._types import TypeChecker
from ._utils import Unset, URIDict
@@ -14,8 +17,6 @@ _JsonObject: TypeAlias = Mapping[str, Any]
_JsonValue: TypeAlias = _JsonObject | list[Any] | str | int | float | bool | None
_ValidatorCallback: TypeAlias = Callable[[Any, Any, _JsonValue, _JsonObject], Iterator[ValidationError]]
_Schema: TypeAlias = Mapping[str, Any]
# This class does not exist at runtime. Compatible classes are created at
# runtime by create().
class _Validator:
@@ -24,31 +25,45 @@ class _Validator:
TYPE_CHECKER: ClassVar[Incomplete]
FORMAT_CHECKER: ClassVar[Incomplete]
@staticmethod
def ID_OF(schema: _Schema) -> str: ...
schema: _Schema
resolver: Incomplete
format_checker: Incomplete
evolve: Incomplete
def __init__(self, schema: _Schema, resolver: Incomplete | None = ..., format_checker: Incomplete | None = ...) -> None: ...
def ID_OF(contents: Schema) -> URI | None: ...
schema: Schema
format_checker: FormatChecker | None
def __init__(
self,
schema: Schema,
resolver: Incomplete | None = None,
format_checker: FormatChecker | None = None,
*,
registry: SchemaRegistry = ...,
_resolver: Incomplete | None = None,
) -> None: ...
@classmethod
def check_schema(cls, schema: _Schema, format_checker: FormatChecker | Unset = ...) -> None: ...
def iter_errors(self, instance, _schema: _Schema | None = ...) -> Generator[Incomplete, None, None]: ...
def check_schema(cls, schema: Schema, format_checker: FormatChecker | Unset = ...) -> None: ...
@property
def resolver(self): ...
def evolve(self, **changes) -> _Validator: ...
def iter_errors(self, instance, _schema: Schema | None = ...) -> Generator[Incomplete, None, None]: ...
def descend(
self, instance, schema: _Schema, path: Incomplete | None = ..., schema_path: Incomplete | None = ...
self,
instance,
schema: Schema,
path: Incomplete | None = ...,
schema_path: Incomplete | None = ...,
resolver: Incomplete | None = None,
) -> Generator[Incomplete, None, None]: ...
def validate(self, *args, **kwargs) -> None: ...
def is_type(self, instance, type): ...
def is_valid(self, instance, _schema: _Schema | None = ...) -> bool: ...
def is_valid(self, instance, _schema: Schema | None = ...) -> bool: ...
def validates(version: str) -> Callable[..., Incomplete]: ...
def create(
meta_schema: _Schema,
meta_schema: Schema,
validators: Mapping[str, _ValidatorCallback] | tuple[()] = (),
version: Incomplete | None = None,
type_checker: TypeChecker = ...,
format_checker: FormatChecker = ...,
id_of: Callable[[_Schema], str] = ...,
applicable_validators: Callable[[_Schema], Iterable[tuple[str, _ValidatorCallback]]] = ...,
id_of: Callable[[Schema], str] = ...,
applicable_validators: Callable[[Schema], Iterable[tuple[str, _ValidatorCallback]]] = ...,
) -> type[_Validator]: ...
def extend(
validator,
@@ -84,7 +99,7 @@ class RefResolver:
remote_cache: Incomplete | None = None,
) -> None: ...
@classmethod
def from_schema(cls, schema: _Schema, id_of=..., *args, **kwargs): ...
def from_schema(cls, schema: Schema, id_of=..., *args, **kwargs): ...
def push_scope(self, scope) -> None: ...
def pop_scope(self) -> None: ...
@property
@@ -100,5 +115,5 @@ class RefResolver:
def resolve_fragment(self, document, fragment): ...
def resolve_remote(self, uri): ...
def validate(instance: object, schema: _Schema, cls: type[_Validator] | None = None, *args: Any, **kwargs: Any) -> None: ...
def validator_for(schema: _Schema | bool, default=...): ...
def validate(instance: object, schema: Schema, cls: type[_Validator] | None = None, *args: Any, **kwargs: Any) -> None: ...
def validator_for(schema: Schema | bool, default=...): ...