Support option v3 inp in
This commit is contained in:
@@ -26,6 +26,7 @@ from .s20_mixing import inp_in_mixing
|
||||
from .s21_times import inp_in_time
|
||||
from .s22_report import inp_in_report
|
||||
from .s23_options import inp_in_option
|
||||
from .s23_options_v3 import inp_in_option_v3
|
||||
from .s24_coordinates import inp_in_coord
|
||||
from .s25_vertices import inp_in_vertex
|
||||
from .s26_labels import inp_in_label
|
||||
@@ -156,7 +157,7 @@ def _get_file_offset(inp: str) -> tuple[dict[str, list[int]], bool]:
|
||||
return (offset, demand_outside)
|
||||
|
||||
|
||||
def parse_file(project: str, inp: str) -> None:
|
||||
def parse_file(project: str, inp: str, version: str = '3') -> None:
|
||||
start = _print_time(f'Start reading file "{inp}"...')
|
||||
|
||||
_print_time("First scan...")
|
||||
@@ -232,6 +233,11 @@ def parse_file(project: str, inp: str) -> None:
|
||||
|
||||
if s == JUNCTIONS:
|
||||
sql_batch.add(handler(line, demand_outside))
|
||||
elif s == OPTIONS:
|
||||
if version == '3':
|
||||
sql_batch.add(inp_in_option_v3(line))
|
||||
else:
|
||||
sql_batch.add(inp_in_option(line))
|
||||
else:
|
||||
sql_batch.add(handler(line))
|
||||
|
||||
@@ -257,7 +263,7 @@ def read_inp(project: str, inp: str, version: str = '3') -> bool:
|
||||
open_project(project)
|
||||
|
||||
try:
|
||||
parse_file(project, inp)
|
||||
parse_file(project, inp, version)
|
||||
except:
|
||||
close_project(project)
|
||||
delete_project(project)
|
||||
@@ -280,7 +286,7 @@ def import_inp(project: str, cs: ChangeSet, version: str = '3') -> bool:
|
||||
f.write(str(cs.operations[0]['inp']))
|
||||
_print_time(f'End writing temp file "{filename}"...')
|
||||
|
||||
result = read_inp(project, filename)
|
||||
result = read_inp(project, filename, version)
|
||||
|
||||
os.remove(filename)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user