@@ -2908,7 +2908,7 @@ def geopos(self, name, *values):
29082908
29092909 def georadius (self , name , longitude , latitude , radius , unit = None ,
29102910 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 ):
29122912 """
29132913 Return the members of the specified key identified by the
29142914 ``name`` argument which are within the borders of the area specified
@@ -2942,11 +2942,12 @@ def georadius(self, name, longitude, latitude, radius, unit=None,
29422942 unit = unit , withdist = withdist ,
29432943 withcoord = withcoord , withhash = withhash ,
29442944 count = count , sort = sort , store = store ,
2945- store_dist = store_dist )
2945+ store_dist = store_dist , any = any )
29462946
29472947 def georadiusbymember (self , name , member , radius , unit = None ,
29482948 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 ):
29502951 """
29512952 This command is exactly like ``georadius`` with the sole difference
29522953 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,
29582959 withdist = withdist , withcoord = withcoord ,
29592960 withhash = withhash , count = count ,
29602961 sort = sort , store = store ,
2961- store_dist = store_dist )
2962+ store_dist = store_dist , any = any )
29622963
29632964 def _georadiusgeneric (self , command , * args , ** kwargs ):
29642965 pieces = list (args )
@@ -2969,21 +2970,26 @@ def _georadiusgeneric(self, command, *args, **kwargs):
29692970 else :
29702971 pieces .append ('m' ,)
29712972
2973+ if kwargs ['any' ] and kwargs ['count' ] is None :
2974+ raise DataError ("``any`` can't be provided without ``count``" )
2975+
29722976 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' )):
29762980 if kwargs [arg_name ]:
29772981 pieces .append (byte_repr )
29782982
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' )
29812987
29822988 if kwargs ['sort' ]:
29832989 if kwargs ['sort' ] == 'ASC' :
2984- pieces .append (b 'ASC' )
2990+ pieces .append ('ASC' )
29852991 elif kwargs ['sort' ] == 'DESC' :
2986- pieces .append (b 'DESC' )
2992+ pieces .append ('DESC' )
29872993 else :
29882994 raise DataError ("GEORADIUS invalid sort" )
29892995
@@ -3116,7 +3122,8 @@ def _geosearchgeneric(self, command, *args, **kwargs):
31163122 if kwargs ['any' ]:
31173123 pieces .append (b'ANY' )
31183124 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" )
31203127
31213128 # other properties
31223129 for arg_name , byte_repr in (
0 commit comments