Skip to content

Commit 8f0088d

Browse files
author
Andrei Neagu
committed
fixed typing
1 parent 213906a commit 8f0088d

File tree

1 file changed

+9
-4
lines changed
  • services/storage/src/simcore_service_storage/modules/celery

1 file changed

+9
-4
lines changed

services/storage/src/simcore_service_storage/modules/celery/_task.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from functools import wraps
77
from typing import Any, Concatenate, Final, ParamSpec, TypeVar, overload
88

9-
from celery import Celery, Task # type: ignore[import-untyped]
9+
from celery import Celery # type: ignore[import-untyped]
1010
from celery.contrib.abortable import AbortableTask # type: ignore[import-untyped]
1111
from pydantic import NonNegativeInt
1212

@@ -57,10 +57,15 @@ def _error_handling(
5757
max_retries: NonNegativeInt,
5858
delay_between_retries: timedelta,
5959
dont_autoretry_for: tuple[type[Exception], ...],
60-
):
61-
def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
60+
) -> Callable[
61+
[Callable[Concatenate[AbortableTask, P], R]],
62+
Callable[Concatenate[AbortableTask, P], R],
63+
]:
64+
def decorator(
65+
func: Callable[Concatenate[AbortableTask, P], R],
66+
) -> Callable[Concatenate[AbortableTask, P], R]:
6267
@wraps(func)
63-
def wrapper(task: Task, *args: Any, **kwargs: Any) -> Any:
68+
def wrapper(task: AbortableTask, *args: P.args, **kwargs: P.kwargs) -> R:
6469
try:
6570
return func(task, *args, **kwargs)
6671
except Exception as exc:

0 commit comments

Comments
 (0)