Skip to content

Commit 864165f

Browse files
committed
chore: enable new ruff rules
1 parent 3c689f3 commit 864165f

File tree

86 files changed

+366
-382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+366
-382
lines changed

docs/examples/extending/broker.py

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

33
from taskiq import AckableMessage, AsyncBroker, BrokerMessage
44

@@ -23,7 +23,7 @@ async def kick(self, message: BrokerMessage) -> None:
2323
# Send a message.message.
2424
pass
2525

26-
async def listen(self) -> AsyncGenerator[Union[bytes, AckableMessage], None]:
26+
async def listen(self) -> AsyncGenerator[bytes | AckableMessage, None]:
2727
while True:
2828
# Get new message.
2929
new_message: bytes = ... # type: ignore

docs/examples/extending/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from argparse import ArgumentParser
2-
from typing import Sequence
2+
from collections.abc import Sequence
33

44
from taskiq.abc.cmd import TaskiqCMD
55

docs/examples/extending/schedule_source.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import List
2-
31
from taskiq import ScheduledTask, ScheduleSource
42

53

@@ -10,7 +8,7 @@ async def startup(self) -> None:
108
async def shutdown(self) -> None:
119
"""Do something on shutdown."""
1210

13-
async def get_schedules(self) -> List["ScheduledTask"]:
11+
async def get_schedules(self) -> list["ScheduledTask"]:
1412
# Here you must return list of scheduled tasks from your source.
1513
return [
1614
ScheduledTask(

docs/examples/schedule/intro.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from taskiq_aio_pika import AioPikaBroker
22

3-
from taskiq.schedule_sources import LabelScheduleSource
43
from taskiq import TaskiqScheduler
4+
from taskiq.schedule_sources import LabelScheduleSource
55

66
broker = AioPikaBroker("amqp://guest:guest@localhost:5672/")
77

docs/examples/schedule/redis_schedule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
@broker.task
1616
async def my_task(arg1: int, arg2: str) -> None:
1717
"""Example task."""
18-
print("Hello from my_task!", arg1, arg2) # noqa: T201
18+
print("Hello from my_task!", arg1, arg2)

docs/examples/state/async_generator_deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import asyncio
2-
from typing import AsyncGenerator
2+
from collections.abc import AsyncGenerator
33

44
from taskiq import TaskiqDepends
55

docs/examples/state/async_generator_deps_annot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import asyncio
2-
from typing import Annotated, AsyncGenerator
2+
from collections.abc import AsyncGenerator
3+
from typing import Annotated
34

45
from taskiq import TaskiqDepends
56

docs/examples/state/events_example.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
from typing import Optional
32

43
from redis.asyncio import ConnectionPool, Redis # type: ignore
54
from taskiq_aio_pika import AioPikaBroker
@@ -30,7 +29,7 @@ async def shutdown(state: TaskiqState) -> None:
3029

3130

3231
@broker.task
33-
async def get_val(key: str, context: Context = TaskiqDepends()) -> Optional[str]:
32+
async def get_val(key: str, context: Context = TaskiqDepends()) -> str | None:
3433
# Now we can use our pool.
3534
redis = Redis(connection_pool=context.state.redis, decode_responses=True)
3635
return await redis.get(key)

docs/examples/state/events_example_annot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import asyncio
2-
from typing import Annotated, Optional
2+
from typing import Annotated
33

44
from redis.asyncio import ConnectionPool, Redis # type: ignore
55
from taskiq_aio_pika import AioPikaBroker
@@ -33,7 +33,7 @@ async def shutdown(state: TaskiqState) -> None:
3333
async def get_val(
3434
key: str,
3535
context: Annotated[Context, TaskiqDepends()],
36-
) -> Optional[str]:
36+
) -> str | None:
3737
# Now we can use our pool.
3838
redis = Redis(connection_pool=context.state.redis, decode_responses=True)
3939
return await redis.get(key)

docs/examples/state/generator_deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Generator
1+
from collections.abc import Generator
22

33
from taskiq import TaskiqDepends
44

0 commit comments

Comments
 (0)