-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: wiseaidev <business@wiseai.dev>
- Loading branch information
Showing
15 changed files
with
496 additions
and
713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from redis import asyncio as redis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
import os | ||
|
||
import aioredis | ||
from . import redis | ||
|
||
|
||
URL = os.environ.get("REDIS_OM_URL", None) | ||
|
||
|
||
def get_redis_connection(**kwargs) -> aioredis.Redis: | ||
def get_redis_connection(**kwargs) -> redis.Redis: | ||
# If someone passed in a 'url' parameter, or specified a REDIS_OM_URL | ||
# environment variable, we'll create the Redis client from the URL. | ||
url = kwargs.pop("url", URL) | ||
if url: | ||
return aioredis.Redis.from_url(url, **kwargs) | ||
return redis.Redis.from_url(url, **kwargs) | ||
|
||
# Decode from UTF-8 by default | ||
if "decode_responses" not in kwargs: | ||
kwargs["decode_responses"] = True | ||
return aioredis.Redis(**kwargs) | ||
return redis.Redis(**kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import redis |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import inspect | ||
|
||
|
||
def is_async_mode(): | ||
async def f(): | ||
"""Unasync transforms async functions in sync functions""" | ||
return None | ||
|
||
return inspect.iscoroutinefunction(f) | ||
|
||
|
||
ASYNC_MODE = is_async_mode() |
Oops, something went wrong.