Skip to content

Commit 937d31d

Browse files
authored
Stubs for jsonschema (#5784)
1 parent 6d7159c commit 937d31d

File tree

14 files changed

+324
-0
lines changed

14 files changed

+324
-0
lines changed

pyrightconfig.stricter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"stubs/httplib2",
4040
"stubs/Jinja2",
4141
"stubs/jmespath",
42+
"stubs/jsonschema",
4243
"stubs/Markdown",
4344
"stubs/oauthlib",
4445
"stubs/Pillow",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
jsonschema._format.is_css21_color
2+
jsonschema._format.is_css3_color
3+
jsonschema._format.is_css_color_code
4+
jsonschema._format.is_datetime
5+
jsonschema._format.is_idn_host_name
6+
jsonschema._format.is_iri
7+
jsonschema._format.is_iri_reference
8+
jsonschema._format.is_json_pointer
9+
jsonschema._format.is_relative_json_pointer
10+
jsonschema._format.is_time
11+
jsonschema._format.is_uri
12+
jsonschema._format.is_uri_reference
13+
jsonschema._format.is_uri_template

stubs/jsonschema/METADATA.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version = "3.2"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from jsonschema._format import (
2+
FormatChecker as FormatChecker,
3+
draft3_format_checker as draft3_format_checker,
4+
draft4_format_checker as draft4_format_checker,
5+
draft6_format_checker as draft6_format_checker,
6+
draft7_format_checker as draft7_format_checker,
7+
)
8+
from jsonschema._types import TypeChecker as TypeChecker
9+
from jsonschema.exceptions import (
10+
ErrorTree as ErrorTree,
11+
FormatError as FormatError,
12+
RefResolutionError as RefResolutionError,
13+
SchemaError as SchemaError,
14+
ValidationError as ValidationError,
15+
)
16+
from jsonschema.validators import (
17+
Draft3Validator as Draft3Validator,
18+
Draft4Validator as Draft4Validator,
19+
Draft6Validator as Draft6Validator,
20+
Draft7Validator as Draft7Validator,
21+
RefResolver as RefResolver,
22+
validate as validate,
23+
)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from typing import Any
2+
3+
class FormatChecker:
4+
checkers: Any
5+
def __init__(self, formats: Any | None = ...) -> None: ...
6+
def checks(self, format, raises=...): ...
7+
cls_checks: Any
8+
def check(self, instance, format) -> None: ...
9+
def conforms(self, instance, format): ...
10+
11+
draft3_format_checker: Any
12+
draft4_format_checker: Any
13+
draft6_format_checker: Any
14+
draft7_format_checker: Any
15+
16+
def is_email(instance): ...
17+
def is_ipv4(instance): ...
18+
def is_ipv6(instance): ...
19+
def is_host_name(instance): ...
20+
def is_idn_host_name(instance): ...
21+
def is_uri(instance): ...
22+
def is_uri_reference(instance): ...
23+
def is_iri(instance): ...
24+
def is_iri_reference(instance): ...
25+
def is_datetime(instance): ...
26+
def is_time(instance): ...
27+
def is_regex(instance): ...
28+
def is_date(instance): ...
29+
def is_draft3_time(instance): ...
30+
def is_css_color_code(instance): ...
31+
def is_css21_color(instance): ...
32+
def is_css3_color(instance): ...
33+
def is_json_pointer(instance): ...
34+
def is_relative_json_pointer(instance): ...
35+
def is_uri_template(instance, template_validator=...): ...
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def dependencies_draft3(validator, dependencies, instance, schema) -> None: ...
2+
def disallow_draft3(validator, disallow, instance, schema) -> None: ...
3+
def extends_draft3(validator, extends, instance, schema) -> None: ...
4+
def items_draft3_draft4(validator, items, instance, schema) -> None: ...
5+
def minimum_draft3_draft4(validator, minimum, instance, schema) -> None: ...
6+
def maximum_draft3_draft4(validator, maximum, instance, schema) -> None: ...
7+
def properties_draft3(validator, properties, instance, schema) -> None: ...
8+
def type_draft3(validator, types, instance, schema) -> None: ...
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class _NoModuleFound(Exception): ...
2+
class InvalidName(ValueError): ...
3+
class ModuleNotFound(InvalidName): ...
4+
class ObjectNotFound(InvalidName): ...
5+
6+
def reraise(exception, traceback) -> None: ...
7+
def namedAny(name): ...
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from typing import Any
2+
3+
def is_array(checker, instance): ...
4+
def is_bool(checker, instance): ...
5+
def is_integer(checker, instance): ...
6+
def is_null(checker, instance): ...
7+
def is_number(checker, instance): ...
8+
def is_object(checker, instance): ...
9+
def is_string(checker, instance): ...
10+
def is_any(checker, instance): ...
11+
12+
class TypeChecker:
13+
def is_type(self, instance, type): ...
14+
def redefine(self, type, fn): ...
15+
def redefine_many(self, definitions=...): ...
16+
def remove(self, *types): ...
17+
def __init__(self, type_checkers=...) -> None: ...
18+
def __lt__(self, other): ...
19+
def __le__(self, other): ...
20+
def __gt__(self, other): ...
21+
def __ge__(self, other): ...
22+
23+
draft3_type_checker: Any
24+
draft4_type_checker: Any
25+
draft6_type_checker: Any
26+
draft7_type_checker: Any
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from typing import Any, MutableMapping
2+
3+
class URIDict(MutableMapping[Any, Any]):
4+
def normalize(self, uri): ...
5+
store: Any
6+
def __init__(self, *args, **kwargs) -> None: ...
7+
def __getitem__(self, uri): ...
8+
def __setitem__(self, uri, value) -> None: ...
9+
def __delitem__(self, uri) -> None: ...
10+
def __iter__(self): ...
11+
def __len__(self): ...
12+
13+
class Unset: ...
14+
15+
def load_schema(name): ...
16+
def indent(string, times: int = ...): ...
17+
def format_as_index(indices): ...
18+
def find_additional_properties(instance, schema) -> None: ...
19+
def extras_msg(extras): ...
20+
def types_msg(instance, types): ...
21+
def flatten(suitable_for_isinstance): ...
22+
def ensure_list(thing): ...
23+
def equal(one, two): ...
24+
def unbool(element, true=..., false=...): ...
25+
def uniq(container): ...
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
def patternProperties(validator, patternProperties, instance, schema) -> None: ...
2+
def propertyNames(validator, propertyNames, instance, schema) -> None: ...
3+
def additionalProperties(validator, aP, instance, schema) -> None: ...
4+
def items(validator, items, instance, schema) -> None: ...
5+
def additionalItems(validator, aI, instance, schema) -> None: ...
6+
def const(validator, const, instance, schema) -> None: ...
7+
def contains(validator, contains, instance, schema) -> None: ...
8+
def exclusiveMinimum(validator, minimum, instance, schema) -> None: ...
9+
def exclusiveMaximum(validator, maximum, instance, schema) -> None: ...
10+
def minimum(validator, minimum, instance, schema) -> None: ...
11+
def maximum(validator, maximum, instance, schema) -> None: ...
12+
def multipleOf(validator, dB, instance, schema) -> None: ...
13+
def minItems(validator, mI, instance, schema) -> None: ...
14+
def maxItems(validator, mI, instance, schema) -> None: ...
15+
def uniqueItems(validator, uI, instance, schema) -> None: ...
16+
def pattern(validator, patrn, instance, schema) -> None: ...
17+
def format(validator, format, instance, schema) -> None: ...
18+
def minLength(validator, mL, instance, schema) -> None: ...
19+
def maxLength(validator, mL, instance, schema) -> None: ...
20+
def dependencies(validator, dependencies, instance, schema) -> None: ...
21+
def enum(validator, enums, instance, schema) -> None: ...
22+
def ref(validator, ref, instance, schema) -> None: ...
23+
def type(validator, types, instance, schema) -> None: ...
24+
def properties(validator, properties, instance, schema) -> None: ...
25+
def required(validator, required, instance, schema) -> None: ...
26+
def minProperties(validator, mP, instance, schema) -> None: ...
27+
def maxProperties(validator, mP, instance, schema) -> None: ...
28+
def allOf(validator, allOf, instance, schema) -> None: ...
29+
def anyOf(validator, anyOf, instance, schema) -> None: ...
30+
def oneOf(validator, oneOf, instance, schema) -> None: ...
31+
def not_(validator, not_schema, instance, schema) -> None: ...
32+
def if_(validator, if_schema, instance, schema) -> None: ...

0 commit comments

Comments
 (0)