def __init__(self, data): self.data = data if (len(self.deservedStations) > 0 and 'stations' not in self.deservedStations[0]): for i in range(len(self.deservedStations)): self.deservedStations[i]['station'] = Station.find_station( self.deservedStations[i]['label'])
action="store_true", default=False) # Search Places parser search_parser = subparsers.add_parser('search', help='Search for a place') search_parser.add_argument('query', help='query') search_parser.add_argument( '--filter', dest='filter', choices=[filter_name for filter_name in PlaceType.__members__], help="Filter the results") args = parser.parse_args() if (args.command == "trains"): dep_station = Station.find_station(args.dep_station) if (args.arr_station != ""): arr_station = Station.find_station(args.arr_station) if (arr_station is None): print("Unknown arrival station") sys.exit(1) else: arr_station = None trip = Trip.next_trains(dep_station, arr_station, args.handicap) for train in trip.nextTrainsList: print(train) elif (args.command == "search"): list_station = Station.search_list_places(args.query, args.filter) list_attr = [ attr for attr in PlaceType.__members__