|
| 1 | +from typing import Any |
| 2 | + |
1 | 3 | from helpers.load_env import load_settings |
2 | 4 |
|
3 | 5 | from onebusaway import OnebusawaySDK |
|
16 | 18 | oba = OnebusawaySDK(**settings) |
17 | 19 |
|
18 | 20 | space_needle_stops = oba.stops_for_location.retrieve( |
19 | | - key="TEST", # TODO FIXME: I shouldn't have to specify the API key here. |
20 | 21 | lat=47.6205, |
21 | 22 | lon=-122.3493, |
22 | 23 | ) |
|
26 | 27 |
|
27 | 28 | # make it easy to look up routes by ID. |
28 | 29 | reference_map = {} |
29 | | -for route in references.routes: |
30 | | - reference_map[route.id] = route |
| 30 | +for ref_route in references.routes: |
| 31 | + reference_map[ref_route.id] = ref_route |
31 | 32 |
|
32 | 33 | for stop in stops: |
33 | 34 | print(f"{stop.name} ({stop.lat}, {stop.lon})") |
34 | 35 | print(" Routes:") |
35 | 36 |
|
36 | 37 | for route_id in stop.route_ids: |
37 | | - route = reference_map[route_id] |
| 38 | + # TODO: add type to route |
| 39 | + route: Any = reference_map[route_id] |
38 | 40 |
|
39 | 41 | # Get a string that looks like "D Line - Blue Ridge/Crown Hill - Ballard - Downtown Seattle" |
40 | | - description = [route.null_safe_short_name, route.description] |
41 | | - description = [e for e in description if e] |
42 | | - description = " - ".join(description) |
43 | | - print(f" {description}") |
| 42 | + description_list = [route.null_safe_short_name, route.description] |
| 43 | + description_list = [e for e in description_list if e] |
| 44 | + description_str = " - ".join(description_list) |
| 45 | + print(f" {description_str}") |
0 commit comments