@@ -2932,7 +2932,7 @@ def geopos(self, name, *values):
2932
2932
2933
2933
def georadius (self , name , longitude , latitude , radius , unit = None ,
2934
2934
withdist = False , withcoord = False , withhash = False , count = None ,
2935
- sort = None , store = None , store_dist = None ):
2935
+ sort = None , store = None , store_dist = None , any = False ):
2936
2936
"""
2937
2937
Return the members of the specified key identified by the
2938
2938
``name`` argument which are within the borders of the area specified
@@ -2966,11 +2966,12 @@ def georadius(self, name, longitude, latitude, radius, unit=None,
2966
2966
unit = unit , withdist = withdist ,
2967
2967
withcoord = withcoord , withhash = withhash ,
2968
2968
count = count , sort = sort , store = store ,
2969
- store_dist = store_dist )
2969
+ store_dist = store_dist , any = any )
2970
2970
2971
2971
def georadiusbymember (self , name , member , radius , unit = None ,
2972
2972
withdist = False , withcoord = False , withhash = False ,
2973
- count = None , sort = None , store = None , store_dist = None ):
2973
+ count = None , sort = None , store = None , store_dist = None ,
2974
+ any = False ):
2974
2975
"""
2975
2976
This command is exactly like ``georadius`` with the sole difference
2976
2977
that instead of taking, as the center of the area to query, a longitude
@@ -2982,7 +2983,7 @@ def georadiusbymember(self, name, member, radius, unit=None,
2982
2983
withdist = withdist , withcoord = withcoord ,
2983
2984
withhash = withhash , count = count ,
2984
2985
sort = sort , store = store ,
2985
- store_dist = store_dist )
2986
+ store_dist = store_dist , any = any )
2986
2987
2987
2988
def _georadiusgeneric (self , command , * args , ** kwargs ):
2988
2989
pieces = list (args )
@@ -2993,21 +2994,26 @@ def _georadiusgeneric(self, command, *args, **kwargs):
2993
2994
else :
2994
2995
pieces .append ('m' ,)
2995
2996
2997
+ if kwargs ['any' ] and kwargs ['count' ] is None :
2998
+ raise DataError ("``any`` can't be provided without ``count``" )
2999
+
2996
3000
for arg_name , byte_repr in (
2997
- ('withdist' , b 'WITHDIST' ),
2998
- ('withcoord' , b 'WITHCOORD' ),
2999
- ('withhash' , b 'WITHHASH' )):
3001
+ ('withdist' , 'WITHDIST' ),
3002
+ ('withcoord' , 'WITHCOORD' ),
3003
+ ('withhash' , 'WITHHASH' )):
3000
3004
if kwargs [arg_name ]:
3001
3005
pieces .append (byte_repr )
3002
3006
3003
- if kwargs ['count' ]:
3004
- pieces .extend ([b'COUNT' , kwargs ['count' ]])
3007
+ if kwargs ['count' ] is not None :
3008
+ pieces .extend (['COUNT' , kwargs ['count' ]])
3009
+ if kwargs ['any' ]:
3010
+ pieces .append ('ANY' )
3005
3011
3006
3012
if kwargs ['sort' ]:
3007
3013
if kwargs ['sort' ] == 'ASC' :
3008
- pieces .append (b 'ASC' )
3014
+ pieces .append ('ASC' )
3009
3015
elif kwargs ['sort' ] == 'DESC' :
3010
- pieces .append (b 'DESC' )
3016
+ pieces .append ('DESC' )
3011
3017
else :
3012
3018
raise DataError ("GEORADIUS invalid sort" )
3013
3019
@@ -3140,7 +3146,8 @@ def _geosearchgeneric(self, command, *args, **kwargs):
3140
3146
if kwargs ['any' ]:
3141
3147
pieces .append (b'ANY' )
3142
3148
elif kwargs ['any' ]:
3143
- raise DataError ("GEOSEARCH any can't be provided without count" )
3149
+ raise DataError ("GEOSEARCH ``any`` can't be provided "
3150
+ "without count" )
3144
3151
3145
3152
# other properties
3146
3153
for arg_name , byte_repr in (
0 commit comments