File tree 3 files changed +8
-12
lines changed
3 files changed +8
-12
lines changed Original file line number Diff line number Diff line change 7
7
@lru_cache (maxsize = None )
8
8
async def check_for_command (conn , cmd ):
9
9
cmd_info = await conn .execute_command ("command" , "info" , cmd )
10
- return None not in cmd_info
10
+ return all ( cmd_info )
11
11
12
12
13
13
@lru_cache (maxsize = None )
14
14
async def has_redis_json (conn = None ):
15
- if not conn :
16
- conn = get_redis_connection ()
17
- command_exists = await check_for_command (conn , "json.set" )
15
+ command_exists = await check_for_command (conn or get_redis_connection (), "json.set" )
18
16
return command_exists
19
17
20
18
Original file line number Diff line number Diff line change 9
9
def get_redis_connection (** kwargs ) -> aioredis .Redis :
10
10
# If someone passed in a 'url' parameter, or specified a REDIS_OM_URL
11
11
# 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
16
14
# Decode from UTF-8 by default
17
- if "decode_responses" not in kwargs :
15
+ if not kwargs . get ( "decode_responses" , None ) :
18
16
kwargs ["decode_responses" ] = True
19
- return aioredis .Redis (** kwargs )
17
+ return aioredis .from_url (** kwargs )
Original file line number Diff line number Diff line change @@ -1195,12 +1195,12 @@ def to_string(s):
1195
1195
step = 2 # Because the result has content
1196
1196
offset = 1 # The first item is the count of total matches.
1197
1197
1198
- for i in range (1 , len (res ), step ):
1198
+ for i in xrange (1 , len (res ), step ):
1199
1199
fields_offset = offset
1200
1200
1201
1201
fields = dict (
1202
1202
dict (
1203
- zip (
1203
+ izip (
1204
1204
map (to_string , res [i + fields_offset ][::2 ]),
1205
1205
map (to_string , res [i + fields_offset ][1 ::2 ]),
1206
1206
)
You can’t perform that action at this time.
0 commit comments