Skip to content

Commit

Permalink
make code more compact
Browse files Browse the repository at this point in the history
Signed-off-by: wiseaidev <business@wiseai.dev>
  • Loading branch information
wiseaidev committed Aug 7, 2022
1 parent dfc7898 commit 4017cf5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions aredis_om/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
def get_redis_connection(**kwargs) -> aioredis.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)

if not kwargs.get("url", None) and URL:
kwargs["url"] = URL
# Decode from UTF-8 by default
if "decode_responses" not in kwargs:
if not kwargs.get("decode_responses", None):
kwargs["decode_responses"] = True
return aioredis.Redis(**kwargs)
return aioredis.from_url(**kwargs)

0 comments on commit 4017cf5

Please sign in to comment.