--- a/alueet.py Thu May 25 16:41:21 2017 +0300 +++ b/alueet.py Sat Jun 10 16:36:36 2017 +0300 @@ -32,15 +32,18 @@ for name, stop_id in representatives.items(): if stop_id is None: continue - for district_shape in district_shapes: - if district_shape.sisältää_pisteen(pysäkit[stop_id]): - assert name not in districts - districts[name] = district_shape - district_shapes.remove(district_shape) - bus_stop_districts[stop_id] = name - break + if stop_id not in pysäkit: + print('Alueen %r edustaja %r ei löydy aikatauluista' % (name, stop_id), file = sys.stderr) else: - print('cannot find a shape for %r' % name, file = sys.stderr) + for district_shape in district_shapes: + if district_shape.sisältää_pisteen(pysäkit[stop_id]): + assert name not in districts + districts[name] = district_shape + district_shapes.remove(district_shape) + bus_stop_districts[stop_id] = name + break + else: + print('cannot find a shape for %r' % name, file = sys.stderr) for stop_id, stop_position in pysäkit.items(): for district, shape in districts.items():