Parse [CONTROLS]

This commit is contained in:
WQY\qiong
2022-11-12 17:08:47 +08:00
parent 26c4fc431b
commit 0d3f9e7244

View File

@@ -24,3 +24,19 @@ def set_control_cache(name: str, cs: ChangeSet) -> SqlChangeSet:
def set_control(name: str, cs: ChangeSet) -> ChangeSet:
return execute_command(name, set_control_cache(name, cs))
class InpControl:
def __init__(self, section) -> None:
self.control = '\n'.join(section)
def inp_in_control(section: list[str]) -> ChangeSet:
obj = InpControl(section)
cs = ChangeSet({'operation' : API_UPDATE, 'type': 'control', 'control' : obj.control})
return cs
def inp_out_control(name: str) -> list[str]:
obj = str(get_control(name)['control'])
return obj.split('\n')