Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/redis/asyncio/utils.py: 50%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from typing import TYPE_CHECKING
3if TYPE_CHECKING:
4 from redis.asyncio.client import Pipeline, Redis
7def from_url(url, **kwargs):
8 """
9 Returns an active Redis client generated from the given database URL.
11 Will attempt to extract the database id from the path url fragment, if
12 none is provided.
13 """
14 from redis.asyncio.client import Redis
16 return Redis.from_url(url, **kwargs)
19class pipeline: # noqa: N801
20 def __init__(self, redis_obj: "Redis"):
21 self.p: "Pipeline" = redis_obj.pipeline()
23 async def __aenter__(self) -> "Pipeline":
24 return self.p
26 async def __aexit__(self, exc_type, exc_value, traceback):
27 await self.p.execute()
28 del self.p