Replace set with list
This commit is contained in:
@@ -48,7 +48,7 @@ _handler = {
|
||||
#END : 'END',
|
||||
}
|
||||
|
||||
_level_1 = {
|
||||
_level_1 = [
|
||||
TITLE,
|
||||
PATTERNS,
|
||||
CURVES,
|
||||
@@ -58,15 +58,15 @@ _level_1 = {
|
||||
REPORT,
|
||||
OPTIONS,
|
||||
BACKDROP,
|
||||
}
|
||||
]
|
||||
|
||||
_level_2 = {
|
||||
_level_2 = [
|
||||
JUNCTIONS,
|
||||
RESERVOIRS,
|
||||
TANKS,
|
||||
}
|
||||
]
|
||||
|
||||
_level_3 = {
|
||||
_level_3 = [
|
||||
PIPES,
|
||||
PUMPS,
|
||||
VALVES,
|
||||
@@ -77,15 +77,15 @@ _level_3 = {
|
||||
MIXING,
|
||||
COORDINATES,
|
||||
LABELS,
|
||||
}
|
||||
]
|
||||
|
||||
_level_4 = {
|
||||
_level_4 = [
|
||||
TAGS,
|
||||
STATUS,
|
||||
ENERGY,
|
||||
REACTIONS,
|
||||
VERTICES,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
_UNKNOWN = 'UNKNOWN'
|
||||
@@ -114,9 +114,8 @@ def _get_offset(inp: str) -> dict[str, list[int]]:
|
||||
|
||||
def parse_file(project: str, inp: str) -> None:
|
||||
offset = _get_offset(inp)
|
||||
print(offset)
|
||||
|
||||
levels = _level_1 | _level_2 | _level_3 | _level_4
|
||||
levels = _level_1 + _level_2 + _level_3 + _level_4
|
||||
|
||||
# parse the whole section rather than line
|
||||
sections : dict[str, list[str]]= {}
|
||||
@@ -194,12 +193,14 @@ def read_inp_new(project: str, inp: str) -> bool:
|
||||
create_project(project)
|
||||
open_project(project)
|
||||
|
||||
try:
|
||||
parse_inp(project, inp)
|
||||
|
||||
'''try:
|
||||
parse_inp(project, inp)
|
||||
except:
|
||||
close_project(project)
|
||||
delete_project(project)
|
||||
return False
|
||||
return False'''
|
||||
|
||||
close_project(project)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user