@@ -33,42 +33,42 @@ class WorkerDeclarationError(Exception):
3333 """An error in the declaration of a worker method."""
3434
3535
36- @overload
37- def work (
38- method : Callable [FactoryParamSpec , Coroutine [None , None , ReturnType ]],
39- * ,
40- name : str = "" ,
41- group : str = "default" ,
42- exit_on_error : bool = True ,
43- exclusive : bool = False ,
44- description : str | None = None ,
45- thread : bool = False ,
46- ) -> Callable [FactoryParamSpec , "Worker[ReturnType]" ]: ...
47-
48-
49- @overload
50- def work (
51- method : Callable [FactoryParamSpec , ReturnType ],
52- * ,
53- name : str = "" ,
54- group : str = "default" ,
55- exit_on_error : bool = True ,
56- exclusive : bool = False ,
57- description : str | None = None ,
58- thread : bool = False ,
59- ) -> Callable [FactoryParamSpec , "Worker[ReturnType]" ]: ...
60-
36+ if TYPE_CHECKING :
6137
62- @overload
63- def work (
64- * ,
65- name : str = "" ,
66- group : str = "default" ,
67- exit_on_error : bool = True ,
68- exclusive : bool = False ,
69- description : str | None = None ,
70- thread : bool = False ,
71- ) -> Decorator [..., ReturnType ]: ...
38+ @overload
39+ def work (
40+ method : Callable [FactoryParamSpec , Coroutine [None , None , ReturnType ]],
41+ * ,
42+ name : str = "" ,
43+ group : str = "default" ,
44+ exit_on_error : bool = True ,
45+ exclusive : bool = False ,
46+ description : str | None = None ,
47+ thread : bool = False ,
48+ ) -> Callable [FactoryParamSpec , "Worker[ReturnType]" ]: ...
49+
50+ @overload
51+ def work (
52+ method : Callable [FactoryParamSpec , ReturnType ],
53+ * ,
54+ name : str = "" ,
55+ group : str = "default" ,
56+ exit_on_error : bool = True ,
57+ exclusive : bool = False ,
58+ description : str | None = None ,
59+ thread : bool = False ,
60+ ) -> Callable [FactoryParamSpec , "Worker[ReturnType]" ]: ...
61+
62+ @overload
63+ def work (
64+ * ,
65+ name : str = "" ,
66+ group : str = "default" ,
67+ exit_on_error : bool = True ,
68+ exclusive : bool = False ,
69+ description : str | None = None ,
70+ thread : bool = False ,
71+ ) -> Decorator [..., ReturnType ]: ...
7272
7373
7474def work (
@@ -103,7 +103,7 @@ def decorator(
103103 method : (
104104 Callable [DecoratorParamSpec , ReturnType ]
105105 | Callable [DecoratorParamSpec , Coroutine [None , None , ReturnType ]]
106- )
106+ ),
107107 ) -> Callable [DecoratorParamSpec , Worker [ReturnType ]]:
108108 """The decorator."""
109109
0 commit comments