mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Stubs for jsonschema (#5784)
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
"stubs/httplib2",
|
||||
"stubs/Jinja2",
|
||||
"stubs/jmespath",
|
||||
"stubs/jsonschema",
|
||||
"stubs/Markdown",
|
||||
"stubs/oauthlib",
|
||||
"stubs/Pillow",
|
||||
|
||||
13
stubs/jsonschema/@tests/stubtest_allowlist.txt
Normal file
13
stubs/jsonschema/@tests/stubtest_allowlist.txt
Normal file
@@ -0,0 +1,13 @@
|
||||
jsonschema._format.is_css21_color
|
||||
jsonschema._format.is_css3_color
|
||||
jsonschema._format.is_css_color_code
|
||||
jsonschema._format.is_datetime
|
||||
jsonschema._format.is_idn_host_name
|
||||
jsonschema._format.is_iri
|
||||
jsonschema._format.is_iri_reference
|
||||
jsonschema._format.is_json_pointer
|
||||
jsonschema._format.is_relative_json_pointer
|
||||
jsonschema._format.is_time
|
||||
jsonschema._format.is_uri
|
||||
jsonschema._format.is_uri_reference
|
||||
jsonschema._format.is_uri_template
|
||||
1
stubs/jsonschema/METADATA.toml
Normal file
1
stubs/jsonschema/METADATA.toml
Normal file
@@ -0,0 +1 @@
|
||||
version = "3.2"
|
||||
23
stubs/jsonschema/jsonschema/__init__.pyi
Normal file
23
stubs/jsonschema/jsonschema/__init__.pyi
Normal file
@@ -0,0 +1,23 @@
|
||||
from jsonschema._format import (
|
||||
FormatChecker as FormatChecker,
|
||||
draft3_format_checker as draft3_format_checker,
|
||||
draft4_format_checker as draft4_format_checker,
|
||||
draft6_format_checker as draft6_format_checker,
|
||||
draft7_format_checker as draft7_format_checker,
|
||||
)
|
||||
from jsonschema._types import TypeChecker as TypeChecker
|
||||
from jsonschema.exceptions import (
|
||||
ErrorTree as ErrorTree,
|
||||
FormatError as FormatError,
|
||||
RefResolutionError as RefResolutionError,
|
||||
SchemaError as SchemaError,
|
||||
ValidationError as ValidationError,
|
||||
)
|
||||
from jsonschema.validators import (
|
||||
Draft3Validator as Draft3Validator,
|
||||
Draft4Validator as Draft4Validator,
|
||||
Draft6Validator as Draft6Validator,
|
||||
Draft7Validator as Draft7Validator,
|
||||
RefResolver as RefResolver,
|
||||
validate as validate,
|
||||
)
|
||||
35
stubs/jsonschema/jsonschema/_format.pyi
Normal file
35
stubs/jsonschema/jsonschema/_format.pyi
Normal file
@@ -0,0 +1,35 @@
|
||||
from typing import Any
|
||||
|
||||
class FormatChecker:
|
||||
checkers: Any
|
||||
def __init__(self, formats: Any | None = ...) -> None: ...
|
||||
def checks(self, format, raises=...): ...
|
||||
cls_checks: Any
|
||||
def check(self, instance, format) -> None: ...
|
||||
def conforms(self, instance, format): ...
|
||||
|
||||
draft3_format_checker: Any
|
||||
draft4_format_checker: Any
|
||||
draft6_format_checker: Any
|
||||
draft7_format_checker: Any
|
||||
|
||||
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=...): ...
|
||||
8
stubs/jsonschema/jsonschema/_legacy_validators.pyi
Normal file
8
stubs/jsonschema/jsonschema/_legacy_validators.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
def dependencies_draft3(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 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: ...
|
||||
7
stubs/jsonschema/jsonschema/_reflect.pyi
Normal file
7
stubs/jsonschema/jsonschema/_reflect.pyi
Normal file
@@ -0,0 +1,7 @@
|
||||
class _NoModuleFound(Exception): ...
|
||||
class InvalidName(ValueError): ...
|
||||
class ModuleNotFound(InvalidName): ...
|
||||
class ObjectNotFound(InvalidName): ...
|
||||
|
||||
def reraise(exception, traceback) -> None: ...
|
||||
def namedAny(name): ...
|
||||
26
stubs/jsonschema/jsonschema/_types.pyi
Normal file
26
stubs/jsonschema/jsonschema/_types.pyi
Normal file
@@ -0,0 +1,26 @@
|
||||
from typing import Any
|
||||
|
||||
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): ...
|
||||
|
||||
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): ...
|
||||
|
||||
draft3_type_checker: Any
|
||||
draft4_type_checker: Any
|
||||
draft6_type_checker: Any
|
||||
draft7_type_checker: Any
|
||||
25
stubs/jsonschema/jsonschema/_utils.pyi
Normal file
25
stubs/jsonschema/jsonschema/_utils.pyi
Normal file
@@ -0,0 +1,25 @@
|
||||
from typing import Any, MutableMapping
|
||||
|
||||
class URIDict(MutableMapping[Any, Any]):
|
||||
def normalize(self, uri): ...
|
||||
store: Any
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def __getitem__(self, uri): ...
|
||||
def __setitem__(self, uri, value) -> None: ...
|
||||
def __delitem__(self, uri) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __len__(self): ...
|
||||
|
||||
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 unbool(element, true=..., false=...): ...
|
||||
def uniq(container): ...
|
||||
32
stubs/jsonschema/jsonschema/_validators.pyi
Normal file
32
stubs/jsonschema/jsonschema/_validators.pyi
Normal file
@@ -0,0 +1,32 @@
|
||||
def patternProperties(validator, patternProperties, instance, schema) -> None: ...
|
||||
def propertyNames(validator, propertyNames, instance, schema) -> None: ...
|
||||
def additionalProperties(validator, aP, instance, schema) -> None: ...
|
||||
def items(validator, items, instance, schema) -> None: ...
|
||||
def additionalItems(validator, aI, instance, schema) -> None: ...
|
||||
def const(validator, const, instance, schema) -> None: ...
|
||||
def contains(validator, contains, instance, schema) -> None: ...
|
||||
def exclusiveMinimum(validator, minimum, instance, schema) -> None: ...
|
||||
def exclusiveMaximum(validator, maximum, instance, schema) -> None: ...
|
||||
def minimum(validator, minimum, instance, schema) -> None: ...
|
||||
def maximum(validator, maximum, instance, schema) -> None: ...
|
||||
def multipleOf(validator, dB, instance, schema) -> None: ...
|
||||
def minItems(validator, mI, instance, schema) -> None: ...
|
||||
def maxItems(validator, mI, instance, schema) -> None: ...
|
||||
def uniqueItems(validator, uI, instance, schema) -> None: ...
|
||||
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 enum(validator, enums, instance, schema) -> None: ...
|
||||
def ref(validator, ref, instance, schema) -> None: ...
|
||||
def type(validator, types, instance, schema) -> None: ...
|
||||
def properties(validator, properties, instance, schema) -> None: ...
|
||||
def required(validator, required, instance, schema) -> None: ...
|
||||
def minProperties(validator, mP, instance, schema) -> None: ...
|
||||
def maxProperties(validator, mP, instance, schema) -> None: ...
|
||||
def allOf(validator, allOf, instance, schema) -> None: ...
|
||||
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: ...
|
||||
10
stubs/jsonschema/jsonschema/cli.pyi
Normal file
10
stubs/jsonschema/jsonschema/cli.pyi
Normal file
@@ -0,0 +1,10 @@
|
||||
from typing import Any
|
||||
|
||||
from jsonschema._reflect import namedAny as namedAny
|
||||
from jsonschema.validators import validator_for as validator_for
|
||||
|
||||
parser: Any
|
||||
|
||||
def parse_args(args): ...
|
||||
def main(args=...) -> None: ...
|
||||
def run(arguments, stdout=..., stderr=...): ...
|
||||
0
stubs/jsonschema/jsonschema/compat.pyi
Normal file
0
stubs/jsonschema/jsonschema/compat.pyi
Normal file
81
stubs/jsonschema/jsonschema/exceptions.pyi
Normal file
81
stubs/jsonschema/jsonschema/exceptions.pyi
Normal file
@@ -0,0 +1,81 @@
|
||||
from typing import Any
|
||||
|
||||
WEAK_MATCHES: Any
|
||||
STRONG_MATCHES: Any
|
||||
|
||||
class _Error(Exception):
|
||||
message: Any
|
||||
path: Any
|
||||
schema_path: Any
|
||||
context: Any
|
||||
cause: Any
|
||||
validator: Any
|
||||
validator_value: Any
|
||||
instance: Any
|
||||
schema: Any
|
||||
parent: Any
|
||||
def __init__(
|
||||
self,
|
||||
message,
|
||||
validator=...,
|
||||
path=...,
|
||||
cause: Any | None = ...,
|
||||
context=...,
|
||||
validator_value=...,
|
||||
instance=...,
|
||||
schema=...,
|
||||
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): ...
|
||||
|
||||
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): ...
|
||||
|
||||
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
|
||||
def __init__(self, errors=...) -> None: ...
|
||||
def __contains__(self, index): ...
|
||||
def __getitem__(self, index): ...
|
||||
def __setitem__(self, index, value) -> None: ...
|
||||
def __iter__(self): ...
|
||||
def __len__(self): ...
|
||||
@property
|
||||
def total_errors(self): ...
|
||||
|
||||
def by_relevance(weak=..., strong=...): ...
|
||||
|
||||
relevance: Any
|
||||
|
||||
def best_match(errors, key=...): ...
|
||||
62
stubs/jsonschema/jsonschema/validators.pyi
Normal file
62
stubs/jsonschema/jsonschema/validators.pyi
Normal file
@@ -0,0 +1,62 @@
|
||||
from typing import Any
|
||||
|
||||
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 extend(validator, validators=..., version: Any | None = ..., type_checker: Any | None = ...): ...
|
||||
|
||||
Draft3Validator: Any
|
||||
Draft4Validator: Any
|
||||
Draft6Validator: Any
|
||||
Draft7Validator: Any
|
||||
|
||||
class RefResolver:
|
||||
referrer: Any
|
||||
cache_remote: Any
|
||||
handlers: Any
|
||||
store: Any
|
||||
def __init__(
|
||||
self,
|
||||
base_uri,
|
||||
referrer,
|
||||
store=...,
|
||||
cache_remote: bool = ...,
|
||||
handlers=...,
|
||||
urljoin_cache: Any | None = ...,
|
||||
remote_cache: Any | None = ...,
|
||||
) -> None: ...
|
||||
@classmethod
|
||||
def from_schema(cls, schema, id_of=..., *args, **kwargs): ...
|
||||
def push_scope(self, scope) -> None: ...
|
||||
def pop_scope(self) -> None: ...
|
||||
@property
|
||||
def resolution_scope(self): ...
|
||||
@property
|
||||
def base_uri(self): ...
|
||||
def in_scope(self, scope) -> None: ...
|
||||
def resolving(self, ref) -> None: ...
|
||||
def resolve(self, ref): ...
|
||||
def resolve_from_url(self, url): ...
|
||||
def resolve_fragment(self, document, fragment): ...
|
||||
def resolve_remote(self, uri): ...
|
||||
|
||||
def validate(instance, schema, cls: Any | None = ..., *args, **kwargs) -> None: ...
|
||||
def validator_for(schema, default=...): ...
|
||||
Reference in New Issue
Block a user