Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
XieXiLin2 committed Jan 13, 2024
1 parent 4af3be8 commit a3acbf4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
7 changes: 7 additions & 0 deletions scripts/base/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@
DATA_PATH = ROOT_PATH / "data"
TRAIN_FILE = DATA_PATH / "train.json"
ALIAS_FILE = DATA_PATH / "alias.json"


def const_ready():
if not TMP_PATH.exists():
TMP_PATH.mkdir(parents=True, exist_ok=True)
if not DATA_PATH.exists():
DATA_PATH.mkdir(parents=True, exist_ok=True)
29 changes: 19 additions & 10 deletions scripts/pre_deploy/update_trains.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,31 @@ def convert_trains():
}
for train in train_data_lines:
train_datas = train.split("\t")
train_ids = train_datas[6].split("#")
train_no = []
for train_id in train_ids:
train_id_split = train_id.split("/")
train_no.append(train_id_split[0])
if len(train_id_split) > 1:
train_no.append(
train_id_split[0][: -(len(train_id_split[1]))] + train_id_split[1],
)
# train_ids = train_datas[6].split("#")
# train_no = []
# for train_id in train_ids:
# train_id_split = train_id.split("/")
# train_no.append(train_id_split[0])
# if len(train_id_split) > 1:
# train_no.append(
# train_id_split[0][: -(len(train_id_split[1]))] + train_id_split[1],
# )
# train_data.append(
# {
# "running_start": train_datas[0],
# "running_end": train_datas[1],
# "emu_note": train_datas[4],
# "administrator": administrator_data[train_datas[5].lower()],
# "train_no": train_no,
# },
# )
train_data.append(
{
"running_start": train_datas[0],
"running_end": train_datas[1],
"emu_note": train_datas[4],
"administrator": administrator_data[train_datas[5].lower()],
"train_no": train_no,
"train_no": train_datas[6],
},
)
TRAIN_FILE.write_text(json.dumps(train_data, ensure_ascii=False), "UTF-8")

0 comments on commit a3acbf4

Please sign in to comment.