def gettrolleybusIdList(self): """ Returns a list with every ID avaiable when travelling by trolleybus """ list=[] parsedInfo=CityInfoParser() parsedInfo.loadFile(TROLEI_BUS_INFO_PATH) parsedInfo.parse() for id in parsedInfo.info.keys(): list.append(id) parsedInfo.closeFile() return list
def stationIdToString(self,id1): """ For a given id returns the name of the station """ parsedInfo=CityInfoParser() parsedInfo.loadFile(CITY_INFO_PATH) parsedInfo.parse() parsedInfo.closeFile() for id in parsedInfo.info.keys(): if id1==id: obj = parsedInfo.info[id]["name"] obj = obj.replace('_',' ') obj = obj.title() return obj
def fetchStations(self): """ Returns a list with the names of every single possible station formatted in TitleCase, with the _ stripped off and sorted by alfabetical order. """ list=[] list2=[] parsedInfo=CityInfoParser() parsedInfo.loadFile(CITY_INFO_PATH) parsedInfo.parse() for id in parsedInfo.info.keys(): if not parsedInfo.info[id]["name"] in list: list.append(parsedInfo.info[id]["name"]) list.sort() for obj in list: obj=obj.replace("_",' ') obj=obj.title() list2.append(obj) parsedInfo.closeFile() return list2