Skip to content
Merged
Changes from all commits
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
18 changes: 11 additions & 7 deletions stubs/jsonschema/jsonschema/validators.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ from typing import Any, ClassVar

from ._utils import URIDict

_Schema = Any
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can apparently be a boolean or Mapping[str, str], or at least it is expected to have a .get() method similar to mappings.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have time to investigate this in depth and didn't want to make assumptions, but if you have determined the type I can include it.


# This class does not exist at runtime. Compatible classes are created at
# runtime by create().
class _Validator:
VALIDATORS: ClassVar[dict[Any, Any]]
META_SCHEMA: ClassVar[dict[Any, Any]]
TYPE_CHECKER: Any
@staticmethod
def ID_OF(): ...
def ID_OF(schema: _Schema) -> str: ...
schema: Any
resolver: Any
format_checker: Any
evolve: Any
def __init__(self, schema: _Schema, resolver: Any | None = ..., format_checker: Any | None = ...) -> None: ...
@classmethod
def check_schema(cls, schema) -> None: ...
def iter_errors(self, instance, _schema: Any | None = ...) -> Generator[Any, None, None]: ...
Expand All @@ -30,12 +33,13 @@ def create(
) -> type[_Validator]: ...
def extend(validator, validators=..., version: Any | None = ..., type_checker: Any | None = ...): ...

Draft3Validator: type[_Validator]
Draft4Validator: type[_Validator]
Draft6Validator: type[_Validator]
Draft7Validator: type[_Validator]
Draft201909Validator: type[_Validator]
Draft202012Validator: type[_Validator]
# At runtime these are fields that are assigned the return values of create() calls.
class Draft3Validator(_Validator): ...
class Draft4Validator(_Validator): ...
class Draft6Validator(_Validator): ...
class Draft7Validator(_Validator): ...
class Draft201909Validator(_Validator): ...
class Draft202012Validator(_Validator): ...

_Handler = Callable[[str], Any]

Expand Down