This commit is contained in:
DingZQ
2024-12-28 17:27:00 +08:00
parent 4e9c5ed551
commit 69978c9868
2 changed files with 8 additions and 7 deletions

View File

@@ -387,7 +387,14 @@ def convert_inp_v3_to_v2(inp: str) -> ChangeSet:
create_project(project) create_project(project)
open_project(project) open_project(project)
parse_file(project, inp, '3') filename = f'inp/{project}_temp.inp'
if os.path.exists(filename):
os.remove(filename)
with open(filename, 'w') as f:
f.write(inp)
parse_file(project, filename, '3')
'''try: '''try:
parse_file(project, inp, version) parse_file(project, inp, version)

View File

@@ -1826,13 +1826,7 @@ async def fastapi_convert_v3_to_v2(req: Request) -> ChangeSet:
network = 'v3Tov2' network = 'v3Tov2'
jo_root = await req.json() jo_root = await req.json()
inp = jo_root['inp'] inp = jo_root['inp']
print(inp)
cs = convert_inp_v3_to_v2(inp) cs = convert_inp_v3_to_v2(inp)
print(cs)
op = cs.operations[0] op = cs.operations[0]
open_project(network) open_project(network)
op['vertex'] = json.dumps(get_all_vertices(network)) op['vertex'] = json.dumps(get_all_vertices(network))