Parse [TIMES]
This commit is contained in:
@@ -65,3 +65,25 @@ def set_time_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
|
|||||||
|
|
||||||
def set_time(name: str, cs: ChangeSet) -> ChangeSet:
|
def set_time(name: str, cs: ChangeSet) -> ChangeSet:
|
||||||
return execute_command(name, set_time_cache(name, cs))
|
return execute_command(name, set_time_cache(name, cs))
|
||||||
|
|
||||||
|
|
||||||
|
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:
|
||||||
|
if line.startswith(key):
|
||||||
|
value = line.removeprefix(key).strip()
|
||||||
|
cs |= { key : value }
|
||||||
|
return ChangeSet(cs)
|
||||||
|
|
||||||
|
|
||||||
|
def inp_out_time(name: str) -> list[str]:
|
||||||
|
lines = []
|
||||||
|
objs = read_all(name, f"select * from times")
|
||||||
|
for obj in objs:
|
||||||
|
key = obj['key']
|
||||||
|
value = obj['value']
|
||||||
|
lines.append(f'{key} {value}')
|
||||||
|
return lines
|
||||||
|
|||||||
Reference in New Issue
Block a user