Skip to content

Commit 6570d43

Browse files
fixup: older python support
1 parent cb748f6 commit 6570d43

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ template = "changelog/_template.rst"
117117

118118
[tool.mypy]
119119
mypy_path = "src"
120+
python="3.9"
120121
check_untyped_defs = true
121122
# Hopefully we can set this someday!
122123
# disallow_any_expr = true

src/pluggy/_hook_callers.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@
3838

3939
_T_HookImpl = TypeVar("_T_HookImpl", bound="HookImpl")
4040

41+
4142
# Type alias for completion hook functions
42-
CompletionHook = Callable[
43-
[object | list[object] | None, BaseException | None],
44-
tuple[object | list[object] | None, BaseException | None],
45-
]
43+
class CompletionHook(Protocol):
44+
"""completion hooks are used to express the teardown of hookwrappers
45+
as python has no builtin way to change the result using a
46+
"""
47+
48+
def __call__(
49+
self, result: object | list[object] | None, exception: BaseException | None
50+
) -> tuple[object | list[object] | None, BaseException | None]: ...
4651

4752

4853
def _insert_hookimpl_into_list(

0 commit comments

Comments
 (0)