Skip to content

Commit 48d2483

Browse files
author
rodrigo.nogueira
committed
fix(mypy): properly type valkey conditional import to work in both environments
1 parent 9623227 commit 48d2483

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

examples/background_tasks.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
import asyncio
44
from collections.abc import AsyncIterator
55
from contextlib import asynccontextmanager, suppress
6+
from typing import Any
67

8+
from aiohttp import web
9+
10+
valkey: Any
711
try:
8-
import valkey.asyncio as valkey # type: ignore[import-not-found]
12+
import valkey.asyncio as valkey # noqa: E402
913
except ImportError:
1014
valkey = None
1115

12-
from aiohttp import web
13-
1416
valkey_listener = web.AppKey("valkey_listener", asyncio.Task[None])
1517
websockets = web.AppKey("websockets", list[web.WebSocketResponse])
1618
skip_valkey_key = web.AppKey("skip_valkey", bool)

0 commit comments

Comments
 (0)