diff options
Diffstat (limited to 'webmentions_ssg/tasks/extension.py')
| -rw-r--r-- | webmentions_ssg/tasks/extension.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/webmentions_ssg/tasks/extension.py b/webmentions_ssg/tasks/extension.py index 2e78cc0..94875ff 100644 --- a/webmentions_ssg/tasks/extension.py +++ b/webmentions_ssg/tasks/extension.py @@ -8,7 +8,7 @@ from __future__ import annotations from collections.abc import Callable from functools import update_wrapper, wraps -from typing import Any, ParamSpec, TypeVar +from typing import Any from urllib.parse import urlsplit, urlunsplit from flask import Flask @@ -17,9 +17,6 @@ from huey.api import TaskWrapper from .json_serializer import JSONSerializer -P = ParamSpec("P") -R = TypeVar("R") - class _LazyTask: """Stable public task handle which follows the extension's current backend. @@ -145,7 +142,7 @@ class Huey: ) return self._huey - def _in_app_context(self, func: Callable[P, R]) -> Callable[P, R]: + def _in_app_context[**P, R](self, func: Callable[P, R]) -> Callable[P, R]: """Return a task wrapper that executes with the configured Flask app.""" @wraps(func) @@ -157,7 +154,7 @@ class Huey: return wrapped - def _decorate_task( + def _decorate_task[**P, R]( self, func: Callable[P, R], task_args: tuple[Any, ...], @@ -171,7 +168,7 @@ class Huey: handle.register() return handle - def task( + def task[**P, R]( self, *task_args: Any, **task_kwargs: Any ) -> Callable[[Callable[P, R]], _LazyTask]: """Declare a task even before :meth:`init_app` has run.""" @@ -181,7 +178,7 @@ class Huey: return decorator - def periodic_task( + def periodic_task[**P, R]( self, *task_args: Any, **task_kwargs: Any ) -> Callable[[Callable[P, R]], _LazyTask]: """Declare a periodic task against the current or next backend.""" |
