@@ -2908,7 +2908,7 @@ def geopos(self, name, *values):
2908
2908
2909
2909
def georadius (self , name , longitude , latitude , radius , unit = None ,
2910
2910
withdist = False , withcoord = False , withhash = False , count = None ,
2911
- sort = None , store = None , store_dist = None ):
2911
+ sort = None , store = None , store_dist = None , any = False ):
2912
2912
"""
2913
2913
Return the members of the specified key identified by the
2914
2914
``name`` argument which are within the borders of the area specified
@@ -2942,11 +2942,12 @@ def georadius(self, name, longitude, latitude, radius, unit=None,
2942
2942
unit = unit , withdist = withdist ,
2943
2943
withcoord = withcoord , withhash = withhash ,
2944
2944
count = count , sort = sort , store = store ,
2945
- store_dist = store_dist )
2945
+ store_dist = store_dist , any = any )
2946
2946
2947
2947
def georadiusbymember (self , name , member , radius , unit = None ,
2948
2948
withdist = False , withcoord = False , withhash = False ,
2949
- count = None , sort = None , store = None , store_dist = None ):
2949
+ count = None , sort = None , store = None , store_dist = None ,
2950
+ any = False ):
2950
2951
"""
2951
2952
This command is exactly like ``georadius`` with the sole difference
2952
2953
that instead of taking, as the center of the area to query, a longitude
@@ -2958,7 +2959,7 @@ def georadiusbymember(self, name, member, radius, unit=None,
2958
2959
withdist = withdist , withcoord = withcoord ,
2959
2960
withhash = withhash , count = count ,
2960
2961
sort = sort , store = store ,
2961
- store_dist = store_dist )
2962
+ store_dist = store_dist , any = any )
2962
2963
2963
2964
def _georadiusgeneric (self , command , * args , ** kwargs ):
2964
2965
pieces = list (args )
@@ -2969,21 +2970,26 @@ def _georadiusgeneric(self, command, *args, **kwargs):
2969
2970
else :
2970
2971
pieces .append ('m' ,)
2971
2972
2973
+ if kwargs ['any' ] and kwargs ['count' ] is None :
2974
+ raise DataError ("``any`` can't be provided without ``count``" )
2975
+
2972
2976
for arg_name , byte_repr in (
2973
- ('withdist' , b 'WITHDIST' ),
2974
- ('withcoord' , b 'WITHCOORD' ),
2975
- ('withhash' , b 'WITHHASH' )):
2977
+ ('withdist' , 'WITHDIST' ),
2978
+ ('withcoord' , 'WITHCOORD' ),
2979
+ ('withhash' , 'WITHHASH' )):
2976
2980
if kwargs [arg_name ]:
2977
2981
pieces .append (byte_repr )
2978
2982
2979
- if kwargs ['count' ]:
2980
- pieces .extend ([b'COUNT' , kwargs ['count' ]])
2983
+ if kwargs ['count' ] is not None :
2984
+ pieces .extend (['COUNT' , kwargs ['count' ]])
2985
+ if kwargs ['any' ]:
2986
+ pieces .append ('ANY' )
2981
2987
2982
2988
if kwargs ['sort' ]:
2983
2989
if kwargs ['sort' ] == 'ASC' :
2984
- pieces .append (b 'ASC' )
2990
+ pieces .append ('ASC' )
2985
2991
elif kwargs ['sort' ] == 'DESC' :
2986
- pieces .append (b 'DESC' )
2992
+ pieces .append ('DESC' )
2987
2993
else :
2988
2994
raise DataError ("GEORADIUS invalid sort" )
2989
2995
@@ -3116,7 +3122,8 @@ def _geosearchgeneric(self, command, *args, **kwargs):
3116
3122
if kwargs ['any' ]:
3117
3123
pieces .append (b'ANY' )
3118
3124
elif kwargs ['any' ]:
3119
- raise DataError ("GEOSEARCH any can't be provided without count" )
3125
+ raise DataError ("GEOSEARCH ``any`` can't be provided "
3126
+ "without count" )
3120
3127
3121
3128
# other properties
3122
3129
for arg_name , byte_repr in (
0 commit comments