Skip to content

Commit 4017cf5

Browse files
committed
make code more compact
Signed-off-by: wiseaidev <business@wiseai.dev>
1 parent dfc7898 commit 4017cf5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

aredis_om/connections.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
def get_redis_connection(**kwargs) -> aioredis.Redis:
1010
# If someone passed in a 'url' parameter, or specified a REDIS_OM_URL
1111
# environment variable, we'll create the Redis client from the URL.
12-
url = kwargs.pop("url", URL)
13-
if url:
14-
return aioredis.Redis.from_url(url, **kwargs)
15-
12+
if not kwargs.get("url", None) and URL:
13+
kwargs["url"] = URL
1614
# Decode from UTF-8 by default
17-
if "decode_responses" not in kwargs:
15+
if not kwargs.get("decode_responses", None):
1816
kwargs["decode_responses"] = True
19-
return aioredis.Redis(**kwargs)
17+
return aioredis.from_url(**kwargs)

0 commit comments

Comments
 (0)