Support inp in tag, demand, status
This commit is contained in:
@@ -97,6 +97,23 @@ def inp_in_demand(section: list[str]) -> ChangeSet:
|
||||
return cs
|
||||
|
||||
|
||||
def inp_in_demand_new(name: str, line: str) -> None:
|
||||
tokens = line.split()
|
||||
|
||||
num = len(tokens)
|
||||
has_desc = tokens[-1].startswith(';')
|
||||
num_without_desc = (num - 1) if has_desc else num
|
||||
|
||||
junction = str(tokens[0])
|
||||
demand = float(tokens[1])
|
||||
pattern = str(tokens[2]) if num_without_desc >= 3 else None
|
||||
pattern = f"'{pattern}'" if pattern != None else 'null'
|
||||
category = str(tokens[3]) if num_without_desc >= 4 else None
|
||||
category = f"'{category}'" if category != None else 'null'
|
||||
|
||||
write(name, f"\ninsert into demands (junction, demand, pattern, category) values ('{junction}', {demand}, {pattern}, {category});")
|
||||
|
||||
|
||||
def inp_out_demand(name: str) -> list[str]:
|
||||
lines = []
|
||||
objs = read_all(name, f"select * from demands order by _order")
|
||||
|
||||
Reference in New Issue
Block a user