File: _typing.py

package info (click to toggle)
python-jsonschema 4.19.2-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,584 kB
  • sloc: python: 7,830; makefile: 210; sh: 12
file content (28 lines) | stat: -rw-r--r-- 610 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Some (initially private) typing helpers for jsonschema's types.
"""
from typing import Any, Callable, Iterable, Protocol, Tuple, Union

import referencing.jsonschema

from jsonschema.protocols import Validator


class SchemaKeywordValidator(Protocol):
    def __call__(
        self,
        validator: Validator,
        value: Any,
        instance: Any,
        schema: referencing.jsonschema.Schema,
    ) -> None:
        ...


id_of = Callable[[referencing.jsonschema.Schema], Union[str, None]]


ApplicableValidators = Callable[
    [referencing.jsonschema.Schema],
    Iterable[Tuple[str, Any]],
]