@@ -81,30 +81,23 @@ def distance_in_meters(p1, p2):
8181 return vincenty (p1 , p2 ).meters
8282
8383
84- def filtered_forts (starting_location , origin , forts , proximity , visited_forts = {}, experimental = False , reverse = False ):
85- forts = filter (lambda f : is_active_pokestop (f [0 ], experimental = experimental ,
86- visited_forts = visited_forts , starting_location = starting_location ,
84+ def filtered_forts (starting_location , origin , forts , proximity , visited_forts = {}, reverse = False ):
85+ forts = filter (lambda f : is_active_pokestop (f [0 ], visited_forts = visited_forts , starting_location = starting_location ,
8786 proximity = proximity ),
8887 map (lambda x : (x , distance_in_meters (origin , (x ['latitude' ], x ['longitude' ]))), forts ))
8988
9089 sorted_forts = sorted (forts , key = lambda x : x [1 ], reverse = reverse )
9190 return sorted_forts
9291
9392
94- def is_active_pokestop (fort , experimental , visited_forts , starting_location , proximity ):
93+ def is_active_pokestop (fort , visited_forts , starting_location , proximity ):
9594 is_active_fort = fort .get ('type' , None ) == 1 and ("enabled" in fort or 'lure_info' in fort ) and fort .get (
9695 'cooldown_complete_timestamp_ms' , - 1 ) < time () * 1000
97- if experimental and visited_forts :
98- if proximity and proximity > 0 :
99- return is_active_fort and fort ['id' ] not in visited_forts and distance_in_meters (starting_location , (
100- fort ['latitude' ], fort ['longitude' ])) < proximity
101- else :
102- return is_active_fort and fort ['id' ] not in visited_forts
10396 if proximity and proximity > 0 :
104- return is_active_fort and distance_in_meters (starting_location ,
105- ( fort ['latitude' ], fort ['longitude' ])) < proximity
97+ return is_active_fort and fort [ 'id' ] not in visited_forts and distance_in_meters (starting_location , (
98+ fort ['latitude' ], fort ['longitude' ])) < proximity
10699 else :
107- return is_active_fort
100+ return is_active_fort and fort [ 'id' ] not in visited_forts
108101
109102
110103# from pokemongodev slack @erhan
0 commit comments