Parse [OPTIONS]
This commit is contained in:
@@ -69,10 +69,9 @@ def set_time(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
|
||||
def inp_in_time(section: list[str]) -> ChangeSet:
|
||||
cs = g_update_prefix | { 'type' : 'time' }
|
||||
keys = ['DURATION', 'HYDRAULIC TIMESTEP', 'QUALITY TIMESTEP', 'RULE TIMESTEP', 'PATTERN TIMESTEP', 'PATTERN START', 'REPORT TIMESTEP', 'REPORT START', 'START CLOCKTIME', 'STATISTIC']
|
||||
for s in section:
|
||||
line = s.upper().strip()
|
||||
for key in keys:
|
||||
for key in get_time_schema('').keys():
|
||||
if line.startswith(key):
|
||||
value = line.removeprefix(key).strip()
|
||||
cs |= { key : value }
|
||||
|
||||
@@ -103,3 +103,24 @@ def set_option_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
|
||||
|
||||
def set_option(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
return execute_command(name, set_option_cache(name, cs))
|
||||
|
||||
|
||||
def inp_in_option(section: list[str]) -> ChangeSet:
|
||||
cs = g_update_prefix | { 'type' : 'option' }
|
||||
for s in section:
|
||||
line = s.upper().strip()
|
||||
for key in get_option_schema('').keys():
|
||||
if line.startswith(key):
|
||||
value = line.removeprefix(key).strip()
|
||||
cs |= { key : value }
|
||||
return ChangeSet(cs)
|
||||
|
||||
|
||||
def inp_out_option(name: str) -> list[str]:
|
||||
lines = []
|
||||
objs = read_all(name, f"select * from options")
|
||||
for obj in objs:
|
||||
key = obj['key']
|
||||
value = obj['value']
|
||||
lines.append(f'{key} {value}')
|
||||
return lines
|
||||
|
||||
Reference in New Issue
Block a user