diff --git a/stubs/jsonschema/@tests/stubtest_allowlist.txt b/stubs/jsonschema/@tests/stubtest_allowlist.txt index 5f66c8101..48d08e947 100644 --- a/stubs/jsonschema/@tests/stubtest_allowlist.txt +++ b/stubs/jsonschema/@tests/stubtest_allowlist.txt @@ -1,7 +1,8 @@ jsonschema._format.is_css21_color -jsonschema._format.is_css3_color jsonschema._format.is_css_color_code jsonschema._format.is_datetime +jsonschema._format.is_duration +jsonschema._format.is_host_name jsonschema._format.is_idn_host_name jsonschema._format.is_iri jsonschema._format.is_iri_reference diff --git a/stubs/jsonschema/METADATA.toml b/stubs/jsonschema/METADATA.toml index 38c94680a..cb7498d03 100644 --- a/stubs/jsonschema/METADATA.toml +++ b/stubs/jsonschema/METADATA.toml @@ -1 +1 @@ -version = "3.2.*" +version = "4.2.*" diff --git a/stubs/jsonschema/jsonschema/__init__.pyi b/stubs/jsonschema/jsonschema/__init__.pyi index 87b8e96f5..96cfcb3cc 100644 --- a/stubs/jsonschema/jsonschema/__init__.pyi +++ b/stubs/jsonschema/jsonschema/__init__.pyi @@ -4,6 +4,8 @@ from jsonschema._format import ( draft4_format_checker as draft4_format_checker, draft6_format_checker as draft6_format_checker, draft7_format_checker as draft7_format_checker, + draft201909_format_checker as draft201909_format_checker, + draft202012_format_checker as draft202012_format_checker, ) from jsonschema._types import TypeChecker as TypeChecker from jsonschema.exceptions import ( @@ -18,6 +20,8 @@ from jsonschema.validators import ( Draft4Validator as Draft4Validator, Draft6Validator as Draft6Validator, Draft7Validator as Draft7Validator, + Draft201909Validator as Draft201909Validator, + Draft202012Validator as Draft202012Validator, RefResolver as RefResolver, validate as validate, ) diff --git a/stubs/jsonschema/jsonschema/_format.pyi b/stubs/jsonschema/jsonschema/_format.pyi index fdab126bb..492800ab5 100644 --- a/stubs/jsonschema/jsonschema/_format.pyi +++ b/stubs/jsonschema/jsonschema/_format.pyi @@ -1,35 +1,42 @@ -from typing import Any +from typing import Any, Iterable class FormatChecker: checkers: Any - def __init__(self, formats: Any | None = ...) -> None: ... + def __init__(self, formats: Iterable[str] | None = ...) -> None: ... def checks(self, format, raises=...): ... cls_checks: Any def check(self, instance, format) -> None: ... - def conforms(self, instance, format): ... + def conforms(self, instance, format) -> bool: ... -draft3_format_checker: Any -draft4_format_checker: Any -draft6_format_checker: Any -draft7_format_checker: Any +draft3_format_checker: FormatChecker +draft4_format_checker: FormatChecker +draft6_format_checker: FormatChecker +draft7_format_checker: FormatChecker +draft201909_format_checker: FormatChecker +draft202012_format_checker: FormatChecker -def is_email(instance): ... -def is_ipv4(instance): ... -def is_ipv6(instance): ... -def is_host_name(instance): ... -def is_idn_host_name(instance): ... -def is_uri(instance): ... -def is_uri_reference(instance): ... -def is_iri(instance): ... -def is_iri_reference(instance): ... -def is_datetime(instance): ... -def is_time(instance): ... -def is_regex(instance): ... -def is_date(instance): ... -def is_draft3_time(instance): ... -def is_css_color_code(instance): ... -def is_css21_color(instance): ... -def is_css3_color(instance): ... -def is_json_pointer(instance): ... -def is_relative_json_pointer(instance): ... -def is_uri_template(instance, template_validator=...): ... +def is_email(instance) -> bool: ... +def is_ipv4(instance) -> bool: ... +def is_ipv6(instance) -> bool: ... + +# is_host_name is only defined if fqdn is installed. +def is_host_name(instance) -> bool: ... +def is_idn_host_name(instance) -> bool: ... +def is_uri(instance) -> bool: ... +def is_uri_reference(instance) -> bool: ... +def is_iri(instance) -> bool: ... +def is_iri_reference(instance) -> bool: ... +def is_datetime(instance) -> bool: ... +def is_time(instance) -> bool: ... +def is_regex(instance) -> bool: ... +def is_date(instance) -> bool: ... +def is_draft3_time(instance) -> bool: ... +def is_css_color_code(instance) -> bool: ... +def is_css21_color(instance) -> bool: ... +def is_json_pointer(instance) -> bool: ... +def is_relative_json_pointer(instance) -> bool: ... +def is_uri_template(instance) -> bool: ... + +# is_duration is only defined if isoduration is installed. +def is_duration(instance) -> bool: ... +def is_uuid(instance) -> bool: ... diff --git a/stubs/jsonschema/jsonschema/_legacy_validators.pyi b/stubs/jsonschema/jsonschema/_legacy_validators.pyi index 40e61896d..08a7dd539 100644 --- a/stubs/jsonschema/jsonschema/_legacy_validators.pyi +++ b/stubs/jsonschema/jsonschema/_legacy_validators.pyi @@ -1,8 +1,15 @@ +from typing import Any, ItemsView + +def ignore_ref_siblings(schema) -> list[tuple[str, Any]] | ItemsView[str, Any]: ... def dependencies_draft3(validator, dependencies, instance, schema) -> None: ... +def dependencies_draft4_draft6_draft7(validator, dependencies, instance, schema) -> None: ... def disallow_draft3(validator, disallow, instance, schema) -> None: ... def extends_draft3(validator, extends, instance, schema) -> None: ... def items_draft3_draft4(validator, items, instance, schema) -> None: ... +def items_draft6_draft7_draft201909(validator, items, instance, schema) -> None: ... def minimum_draft3_draft4(validator, minimum, instance, schema) -> None: ... def maximum_draft3_draft4(validator, maximum, instance, schema) -> None: ... def properties_draft3(validator, properties, instance, schema) -> None: ... def type_draft3(validator, types, instance, schema) -> None: ... +def contains_draft6_draft7(validator, contains, instance, schema) -> None: ... +def recursiveRef(validator, recursiveRef, instance, schema) -> None: ... diff --git a/stubs/jsonschema/jsonschema/_types.pyi b/stubs/jsonschema/jsonschema/_types.pyi index efbe6ba4e..5c9705544 100644 --- a/stubs/jsonschema/jsonschema/_types.pyi +++ b/stubs/jsonschema/jsonschema/_types.pyi @@ -1,26 +1,24 @@ -from typing import Any +from typing import Callable, Iterable, Mapping -def is_array(checker, instance): ... -def is_bool(checker, instance): ... -def is_integer(checker, instance): ... -def is_null(checker, instance): ... -def is_number(checker, instance): ... -def is_object(checker, instance): ... -def is_string(checker, instance): ... -def is_any(checker, instance): ... +def is_array(checker, instance) -> bool: ... +def is_bool(checker, instance) -> bool: ... +def is_integer(checker, instance) -> bool: ... +def is_null(checker, instance) -> bool: ... +def is_number(checker, instance) -> bool: ... +def is_object(checker, instance) -> bool: ... +def is_string(checker, instance) -> bool: ... +def is_any(checker, instance) -> bool: ... class TypeChecker: - def is_type(self, instance, type): ... - def redefine(self, type, fn): ... - def redefine_many(self, definitions=...): ... - def remove(self, *types): ... - def __init__(self, type_checkers=...) -> None: ... - def __lt__(self, other): ... - def __le__(self, other): ... - def __gt__(self, other): ... - def __ge__(self, other): ... + def __init__(self, type_checkers: Mapping[str, Callable[[object], bool]] = ...) -> None: ... + def is_type(self, instance, type: str) -> bool: ... + def redefine(self, type: str, fn: Callable[..., bool]) -> TypeChecker: ... + def redefine_many(self, definitions=...) -> TypeChecker: ... + def remove(self, *types: Iterable[str]) -> TypeChecker: ... -draft3_type_checker: Any -draft4_type_checker: Any -draft6_type_checker: Any -draft7_type_checker: Any +draft3_type_checker: TypeChecker +draft4_type_checker: TypeChecker +draft6_type_checker: TypeChecker +draft7_type_checker: TypeChecker +draft201909_type_checker: TypeChecker +draft202012_type_checker: TypeChecker diff --git a/stubs/jsonschema/jsonschema/_utils.pyi b/stubs/jsonschema/jsonschema/_utils.pyi index 596ec6472..448be7e91 100644 --- a/stubs/jsonschema/jsonschema/_utils.pyi +++ b/stubs/jsonschema/jsonschema/_utils.pyi @@ -1,8 +1,8 @@ -from typing import Any, MutableMapping +from typing import Any, Generator, Iterable, Mapping, MutableMapping, Sized class URIDict(MutableMapping[Any, Any]): - def normalize(self, uri): ... - store: Any + def normalize(self, uri: str) -> str: ... + store: dict[Any, Any] def __init__(self, *args, **kwargs) -> None: ... def __getitem__(self, uri): ... def __setitem__(self, uri, value) -> None: ... @@ -13,13 +13,12 @@ class URIDict(MutableMapping[Any, Any]): class Unset: ... def load_schema(name): ... -def indent(string, times: int = ...): ... -def format_as_index(indices): ... -def find_additional_properties(instance, schema) -> None: ... -def extras_msg(extras): ... -def types_msg(instance, types): ... -def flatten(suitable_for_isinstance): ... -def ensure_list(thing): ... -def equal(one, two): ... +def format_as_index(container: str, indices) -> str: ... +def find_additional_properties(instance: Iterable[Any], schema: Mapping[Any, Any]) -> Generator[Any, None, None]: ... +def extras_msg(extras: Iterable[Any] | Sized) -> str: ... +def ensure_list(thing) -> list[Any]: ... +def equal(one, two) -> bool: ... def unbool(element, true=..., false=...): ... -def uniq(container): ... +def uniq(container) -> bool: ... +def find_evaluated_item_indexes_by_schema(validator, instance, schema) -> list[Any]: ... +def find_evaluated_property_keys_by_schema(validator, instance, schema) -> list[Any]: ... diff --git a/stubs/jsonschema/jsonschema/_validators.pyi b/stubs/jsonschema/jsonschema/_validators.pyi index 8afcc3c07..f6daf1268 100644 --- a/stubs/jsonschema/jsonschema/_validators.pyi +++ b/stubs/jsonschema/jsonschema/_validators.pyi @@ -17,9 +17,11 @@ def pattern(validator, patrn, instance, schema) -> None: ... def format(validator, format, instance, schema) -> None: ... def minLength(validator, mL, instance, schema) -> None: ... def maxLength(validator, mL, instance, schema) -> None: ... -def dependencies(validator, dependencies, instance, schema) -> None: ... +def dependentRequired(validator, dependentRequired, instance, schema) -> None: ... +def dependentSchemas(validator, dependentSchemas, instance, schema) -> None: ... def enum(validator, enums, instance, schema) -> None: ... def ref(validator, ref, instance, schema) -> None: ... +def dynamicRef(validator, dynamicRef, instance, schema) -> None: ... def type(validator, types, instance, schema) -> None: ... def properties(validator, properties, instance, schema) -> None: ... def required(validator, required, instance, schema) -> None: ... @@ -30,3 +32,6 @@ def anyOf(validator, anyOf, instance, schema) -> None: ... def oneOf(validator, oneOf, instance, schema) -> None: ... def not_(validator, not_schema, instance, schema) -> None: ... def if_(validator, if_schema, instance, schema) -> None: ... +def unevaluatedItems(validator, unevaluatedItems, instance, schema) -> None: ... +def unevaluatedProperties(validator, unevaluatedProperties, instance, schema) -> None: ... +def prefixItems(validator, prefixItems, instance, schema) -> None: ... diff --git a/stubs/jsonschema/jsonschema/cli.pyi b/stubs/jsonschema/jsonschema/cli.pyi index 1ccff3f60..85c3bd71d 100644 --- a/stubs/jsonschema/jsonschema/cli.pyi +++ b/stubs/jsonschema/jsonschema/cli.pyi @@ -1,10 +1,32 @@ from typing import Any -from jsonschema._reflect import namedAny as namedAny -from jsonschema.validators import validator_for as validator_for +class _CannotLoadFile(Exception): ... + +class _Outputter: + def __init__(self, formatter, stdout, stderr): ... + @classmethod + def from_arguments(cls, arguments, stdout, stderr): ... + def load(self, path): ... + def filenotfound_error(self, **kwargs) -> None: ... + def parsing_error(self, **kwargs) -> None: ... + def validation_error(self, **kwargs) -> None: ... + def validation_success(self, **kwargs) -> None: ... + +class _PrettyFormatter: + def filenotfound_error(self, path, exc_info): ... + def parsing_error(self, path, exc_info): ... + def validation_error(self, instance_path, error): ... + def validation_success(self, instance_path): ... + +class _PlainFormatter: + def __init__(self, error_format): ... + def filenotfound_error(self, path, exc_info): ... + def parsing_error(self, path, exc_info): ... + def validation_error(self, instance_path, error): ... + def validation_success(self, instance_path): ... parser: Any def parse_args(args): ... def main(args=...) -> None: ... -def run(arguments, stdout=..., stderr=...): ... +def run(arguments, stdout=..., stderr=..., stdin=...): ... diff --git a/stubs/jsonschema/jsonschema/compat.pyi b/stubs/jsonschema/jsonschema/compat.pyi deleted file mode 100644 index e69de29bb..000000000 diff --git a/stubs/jsonschema/jsonschema/exceptions.pyi b/stubs/jsonschema/jsonschema/exceptions.pyi index 078d44b64..466264dbb 100644 --- a/stubs/jsonschema/jsonschema/exceptions.pyi +++ b/stubs/jsonschema/jsonschema/exceptions.pyi @@ -27,41 +27,35 @@ class _Error(Exception): schema_path=..., parent: Any | None = ..., ) -> None: ... - def __unicode__(self): ... @classmethod def create_from(cls, other): ... @property def absolute_path(self): ... @property def absolute_schema_path(self): ... + @property + def json_path(self): ... class ValidationError(_Error): ... class SchemaError(_Error): ... class RefResolutionError(Exception): - def __init__(self, cause) -> None: ... - def __lt__(self, other): ... - def __le__(self, other): ... - def __gt__(self, other): ... - def __ge__(self, other): ... + def __init__(self, cause: str) -> None: ... class UndefinedTypeCheck(Exception): type: Any def __init__(self, type) -> None: ... - def __unicode__(self): ... class UnknownType(Exception): type: Any instance: Any schema: Any def __init__(self, type, instance, schema) -> None: ... - def __unicode__(self): ... class FormatError(Exception): message: Any cause: Any def __init__(self, message, cause: Any | None = ...) -> None: ... - def __unicode__(self): ... class ErrorTree: errors: Any diff --git a/stubs/jsonschema/jsonschema/validators.pyi b/stubs/jsonschema/jsonschema/validators.pyi index b9a078e60..782902178 100644 --- a/stubs/jsonschema/jsonschema/validators.pyi +++ b/stubs/jsonschema/jsonschema/validators.pyi @@ -1,32 +1,15 @@ -from typing import Any +from typing import Any, Callable -from jsonschema import exceptions as exceptions -from jsonschema.exceptions import ErrorTree as ErrorTree - -class _DontDoThat(Exception): ... - -validators: Any -meta_schemas: Any - -def validates(version): ... - -class _DefaultTypesDeprecatingMetaClass(type): - DEFAULT_TYPES: Any - -def create( - meta_schema, - validators=..., - version: Any | None = ..., - default_types: Any | None = ..., - type_checker: Any | None = ..., - id_of=..., -): ... +def validates(version: str) -> Callable[..., Any]: ... +def create(meta_schema, validators=..., version: Any | None = ..., type_checker=..., id_of=..., applicable_validators=...): ... def extend(validator, validators=..., version: Any | None = ..., type_checker: Any | None = ...): ... Draft3Validator: Any Draft4Validator: Any Draft6Validator: Any Draft7Validator: Any +Draft201909Validator: Any +Draft202012Validator: Any class RefResolver: referrer: Any