@@ -54,13 +54,26 @@ def func(arg: lt.Any) -> ReturnType:
5454
5555TYPE_CHECKING = False
5656if TYPE_CHECKING or "sphinx.ext.autodoc" in sys .modules : # pragma: no cover
57- from collections .abc import Iterator , Mapping
57+ from collections .abc import Callable , Iterator , Mapping
5858 from contextlib import AbstractContextManager
59- from typing import Any , Callable , Literal , NotRequired , Protocol , Self , TypedDict , TypeVar
59+ from typing import Any , Literal , Protocol , TypedDict , TypeVar
60+
61+ # Missing imports in 3.10. Avoid breaking third-party autodoc generation.
62+ try :
63+ from typing import NotRequired , Self
64+ except ImportError : # PY310
65+ NotRequired = tuple # type: ignore[misc,assignment]
66+ Self = object # type: ignore[misc,assignment]
6067
6168 from acres .typ import Traversable
62- from jsonschema import FormatChecker
63- from jsonschema .protocols import Validator as JsonschemaValidator
69+
70+ # Optional dependency, avoid breaking third-party autodoc generation.
71+ try :
72+ from jsonschema import FormatChecker
73+ from jsonschema .protocols import Validator as JsonschemaValidator
74+ except ImportError :
75+ FormatChecker = object # type: ignore[misc,assignment]
76+ JsonschemaValidator = object # type: ignore[misc,assignment]
6477
6578 # Helpful TypeVars for generic classes and functions.
6679 # These should never be accessed at runtime, only for type checking, so exclude from __all__.
0 commit comments