File: _typing.py

package info (click to toggle)
python-jsonschema 4.25.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,952 kB
  • sloc: python: 8,469; makefile: 210; sh: 12
file content (29 lines) | stat: -rw-r--r-- 630 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
29
"""
Some (initially private) typing helpers for jsonschema's types.
"""
from collections.abc import Iterable
from typing import Any, Callable, Protocol, 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]],
]