Skip to content

Commit a55b472

Browse files
committed
refactor: added UP rule
1 parent 1708493 commit a55b472

File tree

2 files changed

+207
-48
lines changed

2 files changed

+207
-48
lines changed

taskiq_fastapi/initializator.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import copy
2-
from typing import Any, Awaitable, Callable, Mapping, Optional, Union
2+
from collections.abc import Awaitable, Callable, Mapping
3+
from typing import Any
34

45
from fastapi import FastAPI, Request
56
from starlette.requests import HTTPConnection
@@ -9,7 +10,7 @@
910

1011
def startup_event_generator(
1112
broker: AsyncBroker,
12-
app_or_path: Union[str, FastAPI],
13+
app_or_path: str | FastAPI,
1314
) -> Callable[[TaskiqState], Awaitable[None]]:
1415
"""
1516
Generate shutdown event.
@@ -67,7 +68,7 @@ async def shutdown(state: TaskiqState) -> None:
6768
return shutdown
6869

6970

70-
def init(broker: AsyncBroker, app_or_path: Union[str, FastAPI]) -> None:
71+
def init(broker: AsyncBroker, app_or_path: str | FastAPI) -> None:
7172
"""
7273
Add taskiq startup events.
7374
@@ -95,7 +96,7 @@ def init(broker: AsyncBroker, app_or_path: Union[str, FastAPI]) -> None:
9596
def populate_dependency_context(
9697
broker: AsyncBroker,
9798
app: FastAPI,
98-
asgi_state: Optional[Mapping[str, Any]] = None,
99+
asgi_state: Mapping[str, Any] | None = None,
99100
) -> None:
100101
"""
101102
Populate dependency context.

0 commit comments

Comments
 (0)