17
17
from django .db .models .enums import TextChoices
18
18
from django .utils .module_loading import import_string
19
19
from django .utils .translation import pgettext_lazy
20
+ from django .utils .version import PY311
20
21
from typing_extensions import ParamSpec , Self
21
22
22
23
from .exceptions import TaskIntegrityError
@@ -64,7 +65,7 @@ class ResultStatus(TextChoices):
64
65
P = ParamSpec ("P" )
65
66
66
67
67
- @dataclass (frozen = True , slots = True , kw_only = True )
68
+ @dataclass (frozen = True , slots = PY311 , kw_only = True ) # type: ignore[literal-required]
68
69
class Task (Generic [P , T ]):
69
70
priority : int
70
71
"""The Task's priority"""
@@ -252,7 +253,7 @@ def wrapper(f: Callable[P, T]) -> Task[P, T]:
252
253
return wrapper
253
254
254
255
255
- @dataclass (frozen = True , slots = True , kw_only = True )
256
+ @dataclass (frozen = True , slots = PY311 , kw_only = True ) # type: ignore[literal-required]
256
257
class TaskError :
257
258
exception_class_path : str
258
259
traceback : str
@@ -272,7 +273,7 @@ def exception_class(self) -> type[BaseException]:
272
273
return exception_class
273
274
274
275
275
- @dataclass (frozen = True , slots = True , kw_only = True )
276
+ @dataclass (frozen = True , slots = PY311 , kw_only = True ) # type: ignore[literal-required]
276
277
class TaskResult (Generic [T ]):
277
278
task : Task
278
279
"""Task for which this is a result"""
@@ -359,7 +360,7 @@ async def arefresh(self) -> None:
359
360
object .__setattr__ (self , attr , getattr (refreshed_task , attr ))
360
361
361
362
362
- @dataclass (frozen = True , slots = True , kw_only = True )
363
+ @dataclass (frozen = True , slots = PY311 , kw_only = True ) # type: ignore[literal-required]
363
364
class TaskContext :
364
365
task_result : TaskResult
365
366
0 commit comments