(swLat, swLng, neLat, neLng)
| 344 | |
| 345 | @staticmethod |
| 346 | def get_stops(swLat, swLng, neLat, neLng): |
| 347 | if swLat is None or swLng is None or neLat is None or neLng is None: |
| 348 | query = (Pokestop |
| 349 | .select() |
| 350 | .dicts()) |
| 351 | else: |
| 352 | query = (Pokestop |
| 353 | .select() |
| 354 | .where((Pokestop.latitude >= swLat) & |
| 355 | (Pokestop.longitude >= swLng) & |
| 356 | (Pokestop.latitude <= neLat) & |
| 357 | (Pokestop.longitude <= neLng)) |
| 358 | .dicts()) |
| 359 | |
| 360 | # Performance: Disable the garbage collector prior to creating a (potentially) large dict with append() |
| 361 | gc.disable() |
| 362 | |
| 363 | pokestops = [] |
| 364 | for p in query: |
| 365 | if args.china: |
| 366 | p['latitude'], p['longitude'] = \ |
| 367 | transform_from_wgs_to_gcj(p['latitude'], p['longitude']) |
| 368 | pokestops.append(p) |
| 369 | |
| 370 | # Re-enable the GC. |
| 371 | gc.enable() |
| 372 | |
| 373 | return pokestops |
| 374 | |
| 375 | |
| 376 | class Gym(BaseModel): |
no test coverage detected