_typing.py 610 B

12345678910111213141516171819202122232425262728
  1. """
  2. Some (initially private) typing helpers for jsonschema's types.
  3. """
  4. from typing import Any, Callable, Iterable, Protocol, Tuple, Union
  5. import referencing.jsonschema
  6. from jsonschema.protocols import Validator
  7. class SchemaKeywordValidator(Protocol):
  8. def __call__(
  9. self,
  10. validator: Validator,
  11. value: Any,
  12. instance: Any,
  13. schema: referencing.jsonschema.Schema,
  14. ) -> None:
  15. ...
  16. id_of = Callable[[referencing.jsonschema.Schema], Union[str, None]]
  17. ApplicableValidators = Callable[
  18. [referencing.jsonschema.Schema],
  19. Iterable[Tuple[str, Any]],
  20. ]