@@ -46,47 +46,47 @@ def do_ls(self, name: str = ""):
4646 list_cities (query .find ())
4747
4848 def do_city_neighbors (self , args : str ):
49- """find <count > (default: 5) next neighbors to city <name>\n usage: city_neighbors <name>, [,<count >]"""
49+ """find <num > (default: 5) next neighbors to city <name>\n usage: city_neighbors <name> [,<num >]"""
5050 try :
5151 args = args .split (',' )
5252 if len (args ) > 2 :
5353 raise ValueError ()
5454 city = args [0 ]
5555 if len (city ) == 0 :
5656 raise ValueError ()
57- count = 5
57+ num = 5
5858 if len (args ) == 2 :
59- count = int (args [1 ])
59+ num = int (args [1 ])
6060 qb = self ._box .query ()
6161 qb .equals_string (self ._name_prop , city )
6262 query = qb .build ()
6363 cities = query .find ()
6464 if len (cities ) == 1 :
6565 location = cities [0 ].location
6666 qb = self ._box .query ()
67- qb .nearest_neighbors_f32 (self ._location_prop , location , count + 1 ) # +1 for the city
67+ qb .nearest_neighbors_f32 (self ._location_prop , location , num + 1 ) # +1 for the city
6868 qb .not_equals_string (self ._name_prop , city )
6969 neighbors = qb .build ().find_with_scores ()
7070 list_cities_with_scores (neighbors )
7171 else :
7272 print (f"no city found named '{ city } '" )
7373 except ValueError :
74- print ("usage: city_neighbors <name>[,<count >]" )
74+ print ("usage: city_neighbors <name>[,<num: default 5 >]" )
7575
7676 def do_neighbors (self , args ):
77- """find <count > neighbors to geo-coord <lat> <long>.\n usage: neighbors <count >,<latitude>,<longitude>"""
77+ """find <num > neighbors next to geo-coord <lat> <long>.\n usage: neighbors <num >,<latitude>,<longitude>"""
7878 try :
7979 args = args .split (',' )
8080 if len (args ) != 3 :
8181 raise ValueError ()
82- count = int (args [0 ])
82+ num = int (args [0 ])
8383 geocoord = [ float (args [1 ]), float (args [2 ]) ]
8484 qb = self ._box .query ()
85- qb .nearest_neighbors_f32 (self ._location_prop , geocoord , count )
85+ qb .nearest_neighbors_f32 (self ._location_prop , geocoord , num )
8686 neighbors = qb .build ().find_with_scores ()
8787 list_cities_with_scores (neighbors )
8888 except ValueError :
89- print ("usage: neighbors <count >,<latitude>,<longitude>" )
89+ print ("usage: neighbors <num >,<latitude>,<longitude>" )
9090
9191 def do_add (self , args : str ):
9292 """add new location\n usage: add <name>,<lat>,<long>"""
0 commit comments