Remove line letter suffix
This commit is contained in:
parent
a915581ba1
commit
4a2fa001c2
1 changed files with 6 additions and 1 deletions
7
main.py
7
main.py
|
@ -1,4 +1,5 @@
|
||||||
import enum
|
import enum
|
||||||
|
import re
|
||||||
from typing import Any, DefaultDict, List, Optional
|
from typing import Any, DefaultDict, List, Optional
|
||||||
|
|
||||||
import httpx
|
import httpx
|
||||||
|
@ -48,7 +49,11 @@ async def stop(
|
||||||
passages = DefaultDict(list)
|
passages = DefaultDict(list)
|
||||||
for passage in res.json().get("values"):
|
for passage in res.json().get("values"):
|
||||||
if passage.get("id") == stop_id:
|
if passage.get("id") == stop_id:
|
||||||
passages[passage.get("ligne")].append(passage.get("delaipassage"))
|
ligne = passage.get("ligne")
|
||||||
|
ligne = re.sub(
|
||||||
|
"[A-Z]$", "", ligne
|
||||||
|
) # Remove letter suffix to group by commercial line name
|
||||||
|
passages[ligne].append(passage.get("delaipassage"))
|
||||||
passages_list = []
|
passages_list = []
|
||||||
for ligne, delais in passages.items():
|
for ligne, delais in passages.items():
|
||||||
passages_list.append(Passage(ligne=ligne, delais=delais))
|
passages_list.append(Passage(ligne=ligne, delais=delais))
|
||||||
|
|
Reference in a new issue