@@ -2932,7 +2932,7 @@ def geopos(self, name, *values):
29322932
29332933 def georadius (self , name , longitude , latitude , radius , unit = None ,
29342934 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 ):
29362936 """
29372937 Return the members of the specified key identified by the
29382938 ``name`` argument which are within the borders of the area specified
@@ -2966,11 +2966,12 @@ def georadius(self, name, longitude, latitude, radius, unit=None,
29662966 unit = unit , withdist = withdist ,
29672967 withcoord = withcoord , withhash = withhash ,
29682968 count = count , sort = sort , store = store ,
2969- store_dist = store_dist )
2969+ store_dist = store_dist , any = any )
29702970
29712971 def georadiusbymember (self , name , member , radius , unit = None ,
29722972 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 ):
29742975 """
29752976 This command is exactly like ``georadius`` with the sole difference
29762977 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,
29822983 withdist = withdist , withcoord = withcoord ,
29832984 withhash = withhash , count = count ,
29842985 sort = sort , store = store ,
2985- store_dist = store_dist )
2986+ store_dist = store_dist , any = any )
29862987
29872988 def _georadiusgeneric (self , command , * args , ** kwargs ):
29882989 pieces = list (args )
@@ -2993,21 +2994,26 @@ def _georadiusgeneric(self, command, *args, **kwargs):
29932994 else :
29942995 pieces .append ('m' ,)
29952996
2997+ if kwargs ['any' ] and kwargs ['count' ] is None :
2998+ raise DataError ("``any`` can't be provided without ``count``" )
2999+
29963000 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' )):
30003004 if kwargs [arg_name ]:
30013005 pieces .append (byte_repr )
30023006
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' )
30053011
30063012 if kwargs ['sort' ]:
30073013 if kwargs ['sort' ] == 'ASC' :
3008- pieces .append (b 'ASC' )
3014+ pieces .append ('ASC' )
30093015 elif kwargs ['sort' ] == 'DESC' :
3010- pieces .append (b 'DESC' )
3016+ pieces .append ('DESC' )
30113017 else :
30123018 raise DataError ("GEORADIUS invalid sort" )
30133019
@@ -3140,7 +3146,8 @@ def _geosearchgeneric(self, command, *args, **kwargs):
31403146 if kwargs ['any' ]:
31413147 pieces .append (b'ANY' )
31423148 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" )
31443151
31453152 # other properties
31463153 for arg_name , byte_repr in (
0 commit comments