buses.py

changeset 81
d389cdabda00
parent 80
0773b4e5fd10
child 88
3b86597c5a88
equal deleted inserted replaced
80:0773b4e5fd10 81:d389cdabda00
282 for stop_reference, region in json.load(file).items(): 282 for stop_reference, region in json.load(file).items():
283 try: 283 try:
284 bus_stops[stop_reference].region = region 284 bus_stops[stop_reference].region = region
285 except KeyError: 285 except KeyError:
286 pass 286 pass
287 for bus_stop in bus_stops.values():
288 if not hasattr(bus_stop, 'region'):
289 bus_stop.region = None
287 print('%d pysäkkiä' % len(bus_stops), file = stderr) 290 print('%d pysäkkiä' % len(bus_stops), file = stderr)
288 291
289 292
290 class BusStopCluster: 293 class BusStopCluster:
291 def __init__(self): 294 def __init__(self):

mercurial