From 17b4ca16605a374ac51e7fc11d921bc438bb6616 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Tue, 11 Jun 2024 18:25:13 +0200 Subject: [PATCH] fix: shift type definitions to stub file - typing uses ParamSpec whis is supported for Python 3.10+ --- transitions/experimental/decoration.py | 7 +------ transitions/experimental/decoration.pyi | 6 ++++++ 2 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 transitions/experimental/decoration.pyi diff --git a/transitions/experimental/decoration.py b/transitions/experimental/decoration.py index bc305add..2a76e266 100644 --- a/transitions/experimental/decoration.py +++ b/transitions/experimental/decoration.py @@ -1,8 +1,3 @@ -from typing import Callable, ParamSpec - -P = ParamSpec("P") - - -def expect_override(func: Callable[P, bool | None]) -> Callable[P, bool | None]: +def expect_override(func): setattr(func, "expect_override", True) return func diff --git a/transitions/experimental/decoration.pyi b/transitions/experimental/decoration.pyi new file mode 100644 index 00000000..55945c60 --- /dev/null +++ b/transitions/experimental/decoration.pyi @@ -0,0 +1,6 @@ +from typing import Callable, ParamSpec + +P = ParamSpec("P") + + +def expect_override(func: Callable[P, bool | None]) -> Callable[P, bool | None]: ...