Skip to content

Commit

Permalink
兼容无release文本设备
Browse files Browse the repository at this point in the history
  • Loading branch information
hugcabbage committed Oct 21, 2022
1 parent 9de25ff commit c0c3ca0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions preset-models/transit.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ def produce_temp_workfiles(headers: dict, model: str, temp: str):
def produce_release_text(model: str, release: str, temp: str):
# 生成临时.release
with open(release, encoding='utf-8') as f:
text = yaml.safe_load(f)['model_' + model]
text = pd.Series([text['title']] + text['body']) + '\n'
if (m1 := 'model_' + model) in (y1 := yaml.safe_load(f)):
text = y1[m1]
text = pd.Series([text['title']] + text['body']) + '\n'
else:
text = [
f'{model.replace("-", " ")}\n',
'无更多信息,预设请编辑release.yml\n'
]
with open(temp + '.release', 'w', encoding='utf-8') as f:
f.writelines(text)

Expand Down

0 comments on commit c0c3ca0

Please sign in to comment.