1 from realtime import ITipParser
4 def __init__(self, name):
6 self.parser = ITipParser()
7 if name.strip() in self.parser.lines():
8 self.name = name.strip()
10 raise LineNotFoundError('There is no line "%s"' % name.strip())
14 if not self._stations:
15 self._stations = parser.get_stations(self.name)
18 def get_departures(self, stationname):
19 stationname = stationname.strip().lower()
20 stations = self.stations
24 for direction in stations.keys():
25 # filter stations starting with stationname
26 stations[direction] = filter(lambda station: station[0].lower().starts_with(stationname), stations)
27 found = found or bool(stations[direction])
30 # TODO return departures
31 raise NotImplementedError()
33 raise StationNotFoundError('There is no stationname called "%s" at route of line "%s"' % (stationname, self.name))