_typing.py 617 B

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