@@ -1179,32 +1179,24 @@ def find(cls, *expressions: Union[Any, Expression]) -> FindQuery:
11791179 @classmethod
11801180 def from_redis (cls , res : Any ):
11811181 # TODO: Parsing logic copied from redisearch-py. Evaluate.
1182- import six
1183- from six .moves import xrange
1184- from six .moves import zip as izip
1185-
11861182 def to_string (s ):
1187- if isinstance (s , six . string_types ):
1183+ if isinstance (s , ( str ,) ):
11881184 return s
1189- elif isinstance (s , six . binary_type ):
1190- return s .decode ("utf-8" , " ignore" )
1185+ elif isinstance (s , bytes ):
1186+ return s .decode ("ignore" )
11911187 else :
11921188 return s # Not a string we care about
11931189
11941190 docs = []
11951191 step = 2 # Because the result has content
11961192 offset = 1 # The first item is the count of total matches.
11971193
1198- for i in xrange (1 , len (res ), step ):
1199- fields_offset = offset
1200-
1194+ for i in range (1 , len (res ), step ):
12011195 fields = dict (
1202- dict (
1203- izip (
1204- map (to_string , res [i + fields_offset ][::2 ]),
1205- map (to_string , res [i + fields_offset ][1 ::2 ]),
1196+ zip (
1197+ map (to_string , res [i + offset ][::2 ]),
1198+ map (to_string , res [i + offset ][1 ::2 ]),
12061199 )
1207- )
12081200 )
12091201
12101202 try :
@@ -1218,6 +1210,7 @@ def to_string(s):
12181210 doc = cls (** json_fields )
12191211 else :
12201212 doc = cls (** fields )
1213+
12211214 docs .append (doc )
12221215 return docs
12231216
0 commit comments