Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions stubs/jsonschema/jsonschema/validators.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
from _typeshed import SupportsKeysAndGetItem
from collections.abc import Callable, Generator, Iterable, Mapping
from collections.abc import Callable, Generator, Iterable, Iterator, Mapping
from typing import Any, ClassVar
from typing_extensions import TypeAlias

from ._format import FormatChecker
from ._types import TypeChecker
from ._utils import URIDict
from .exceptions import ValidationError

# these type aliases do not exist at runtime, they're only defined here in the stub
_JSON_OBJECT: TypeAlias = Mapping[str, Any]
_JSON_VALUE: TypeAlias = _JSON_OBJECT | list[Any] | str | int | float | bool | None
_ValidatorCallback: TypeAlias = Callable[[Any, Any, _JSON_VALUE, _JSON_OBJECT], Iterator[ValidationError]]

_Schema: TypeAlias = Mapping[str, Any]

Expand Down Expand Up @@ -33,13 +41,13 @@ class _Validator:

def validates(version: str) -> Callable[..., Any]: ...
def create(
meta_schema,
validators=...,
meta_schema: Mapping[str, Any],
validators: Mapping[str, _ValidatorCallback] | tuple[()] = ...,
version: Any | None = ...,
type_checker=...,
format_checker=...,
id_of=...,
applicable_validators=...,
type_checker: TypeChecker = ...,
format_checker: FormatChecker = ...,
id_of: Callable[[bool | _JSON_OBJECT], str] = ...,
applicable_validators: Callable[[_JSON_OBJECT], Iterable[tuple[str, _ValidatorCallback]]] = ...,
) -> type[_Validator]: ...
def extend(
validator, validators=..., version: Any | None = ..., type_checker: Any | None = ..., format_checker: Any | None = ...
Expand Down