Skip to content

Commit d5d4da6

Browse files
authored
Merge pull request #32 from taskiq-python/add-pyupgrade
2 parents 3305ad1 + 87c38d1 commit d5d4da6

11 files changed

Lines changed: 125 additions & 179 deletions

File tree

pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ classifiers = [
1919
"Programming Language :: Python :: 3.11",
2020
"Programming Language :: Python :: 3.12",
2121
"Programming Language :: Python :: 3.13",
22+
"Programming Language :: Python :: 3.14",
2223
"Topic :: System :: Networking",
2324
"Typing :: Typed",
2425
]
2526
dependencies = [
2627
"pydantic>=2,<3",
2728
"taskiq>=0.11.12,<1",
28-
"typing-extensions>=4.3.0,<5",
2929
]
3030
dynamic = ["version"]
3131

@@ -96,6 +96,7 @@ lint.select = [
9696
"ERA", # Checks for commented out code
9797
"PL", # PyLint checks
9898
"RUF", # Specific to Ruff checks
99+
"UP", # Pyupgrade
99100
]
100101
lint.ignore = [
101102
"D105", # Missing docstring in magic method
@@ -131,3 +132,6 @@ allow-magic-value-types = ["int", "str", "float"]
131132

132133
[tool.ruff.lint.flake8-bugbear]
133134
extend-immutable-calls = ["taskiq_dependencies.Depends", "taskiq.TaskiqDepends"]
135+
136+
[tool.pytest.ini_options]
137+
anyio_mode = "auto"

taskiq_pipelines/abc.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
from abc import ABC, abstractmethod
2-
from typing import Any, Dict, Type
2+
from typing import Any, ClassVar
33

44
from taskiq import AsyncBroker, TaskiqResult
5-
from typing_extensions import ClassVar
65

76

87
class AbstractStep(ABC):
98
"""Abstract pipeline step."""
109

1110
_step_name: str
12-
_known_steps: ClassVar[Dict[str, Type["AbstractStep"]]] = {}
11+
_known_steps: ClassVar[dict[str, type["AbstractStep"]]] = {}
1312

1413
def __init_subclass__(cls, step_name: str, **kwargs: Any) -> None:
1514
super().__init_subclass__(**kwargs)

taskiq_pipelines/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import ClassVar, Union
1+
from typing import ClassVar
22

33
from taskiq import TaskiqError
44

@@ -16,7 +16,7 @@ class StepError(PipelineError):
1616
_STEP_NAME: ClassVar[str]
1717

1818
task_id: str
19-
error: Union[BaseException, None]
19+
error: BaseException | None
2020

2121

2222
class MappingError(StepError):

taskiq_pipelines/middleware.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from logging import getLogger
2-
from typing import Any, List, Optional
2+
from typing import Any
33

44
import pydantic
55
from taskiq import TaskiqMessage, TaskiqMiddleware, TaskiqResult
@@ -43,7 +43,7 @@ async def post_save( # noqa: PLR0911
4343
pipeline_data = message.labels[PIPELINE_DATA]
4444
parsed_data = self.broker.serializer.loadb(pipeline_data)
4545
try:
46-
steps_data = pydantic.TypeAdapter(List[DumpedStep]).validate_python(
46+
steps_data = pydantic.TypeAdapter(list[DumpedStep]).validate_python(
4747
parsed_data,
4848
)
4949
except ValueError as err:
@@ -103,7 +103,7 @@ async def on_error(
103103
return
104104
pipe_data = message.labels[PIPELINE_DATA]
105105
try:
106-
steps = pydantic.TypeAdapter(List[DumpedStep]).validate_json(pipe_data)
106+
steps = pydantic.TypeAdapter(list[DumpedStep]).validate_json(pipe_data)
107107
except ValueError:
108108
return
109109
if current_step_num == len(steps) - 1:
@@ -113,7 +113,7 @@ async def on_error(
113113
async def fail_pipeline(
114114
self,
115115
last_task_id: str,
116-
abort: Optional[BaseException] = None,
116+
abort: BaseException | None = None,
117117
) -> None:
118118
"""
119119
This function aborts pipeline.

0 commit comments

Comments
 (0)