#NEWLINE# def autocomplete_on_prefix( conn , guild , prefix ) : #NEWLINE# #INDENT# ( start , end ) = find_prefix_range ( prefix ) #NEWLINE# identifier = str ( uuid . uuid4 ( ) ) #NEWLINE# start += identifier #NEWLINE# end += identifier #NEWLINE# zset_name = ( 'members:' + guild ) #NEWLINE# conn . zadd ( zset_name , start , 0 , end , 0 ) #NEWLINE# pipeline = conn . pipeline ( True ) #NEWLINE# while 1 : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# pipeline . watch ( zset_name ) #NEWLINE# sindex = pipeline . zrank ( zset_name , start ) #NEWLINE# eindex = pipeline . zrank ( zset_name , end ) #NEWLINE# erange = min ( ( sindex + 9 ) , ( eindex - 2 ) ) #NEWLINE# pipeline . multi ( ) #NEWLINE# pipeline . zrem ( zset_name , start , end ) #NEWLINE# pipeline . zrange ( zset_name , sindex , erange ) #NEWLINE# items = pipeline . execute ( ) [ ( - 1 ) ] #NEWLINE# break #NEWLINE# #UNINDENT# except redis . exceptions . WatchError : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# return [ item for item in items if ( '{' not in item ) ]