Compare commits

..

No commits in common. "74fff341be5a98133963c62b981adf950705ec79" and "2df827d3adef6d9f2fde7861f5f1a4c1754cf199" have entirely different histories.

1 changed files with 14 additions and 25 deletions

39
stop.py
View File

@ -17,16 +17,7 @@ line_types = (
'Lianes', 'Lianes',
'Ligne', 'Ligne',
'Bus Relais', 'Bus Relais',
'Citéis',
) )
line_translate = {
'Tram A': 'A',
'Tram B': 'B',
'Tram C': 'C',
'Tram D': 'D',
'TBNight': '58',
'BAT3': '69',
}
def search_stop_by_name (keyword): def search_stop_by_name (keyword):
@ -102,25 +93,23 @@ def show_stops_from_ref (ref):
'terminus': j ['name'], 'terminus': j ['name'],
'line_human': j ['line'] ['name'], 'line_human': j ['line'] ['name'],
} }
add = False try:
if rte ['line_human'] in line_translate: line_id = search ('[0-9A-D]+$', rte ['line_human']).group ()
line_id = line_translate [rte ['line_human']] except AttributeError:
add = True continue
else: try:
try:
line_id = search ('[0-9]+$', rte ['line_human']).group ()
except AttributeError:
continue
line_id = '%02d' % int (line_id) line_id = '%02d' % int (line_id)
for i in line_types: except ValueError:
if rte ['line_human'] [0:len (i)] == i: pass
add = True a = False
break for i in line_types:
if add: if rte ['line_human'] [0:len (i)] == i:
a = True
break
if a:
rte ['line_id'] = line_id rte ['line_id'] = line_id
s ['routes'].append (rte) s ['routes'].append (rte)
if s ['routes'] != []: r ['stop_points'].append (s)
r ['stop_points'].append (s)
return (r) return (r)