def le_linhas(): linhas = [] linhas_dict = LeitorCSV.converte(ARQUIVO_LINHAS, colunas) for linha in linhas_dict: e1 = estacao_por_id(linha['station1']) e2 = estacao_por_id(linha['station2']) rota = rota_por_id(linha['line']) linhas.append(Linha(e1, e2, rota)) return linhas
def le_rotas(): rotas = LeitorCSV.converte(ARQUIVO_ROTAS, colunas) return [Rota(r['line'], r['name']) for r in rotas]
def le_estacoes(): estacoes = LeitorCSV.converte(ARQUIVO_ESTACOES, colunas) return [Estacao(e['id'], e['name']) for e in estacoes]
# # 06/11/2015 # # from leitor_csv import LeitorCSV print(LeitorCSV.converte('data/estacoes.csv', ('id', 'name'))) print(LeitorCSV.converte('data/rotas.csv', ('line', 'name'))) print(LeitorCSV.converte('data/linhas.csv', ('station1', 'station2', 'line')))