Remove old inp in routine
This commit is contained in:
@@ -72,48 +72,9 @@ def set_status(name: str, cs: ChangeSet) -> ChangeSet:
|
||||
# [EPA2][EPA3][IN][OUT]
|
||||
# link value
|
||||
#--------------------------------------------------------------
|
||||
class InpStatus:
|
||||
def __init__(self, line: str) -> None:
|
||||
tokens = line.split()
|
||||
|
||||
num = len(tokens)
|
||||
has_desc = tokens[-1].startswith(';')
|
||||
num_without_desc = (num - 1) if has_desc else num
|
||||
|
||||
self.link = str(tokens[0])
|
||||
self.value = tokens[1].upper()
|
||||
self.is_status = True
|
||||
if self.value == LINK_STATUS_OPEN or self.value == LINK_STATUS_CLOSED or self.value == LINK_STATUS_ACTIVE:
|
||||
self.status = str(self.value)
|
||||
else:
|
||||
self.setting = float(self.value)
|
||||
self.is_status = False
|
||||
|
||||
|
||||
def inp_in_status(section: list[str]) -> ChangeSet:
|
||||
objs: dict[str, list[InpStatus]] = {}
|
||||
for s in section:
|
||||
# skip comment
|
||||
if s.startswith(';'):
|
||||
continue
|
||||
obj = InpStatus(s)
|
||||
if obj.link not in objs:
|
||||
objs[obj.link] = []
|
||||
objs[obj.link].append(obj)
|
||||
|
||||
cs = ChangeSet()
|
||||
for link, values in objs.items():
|
||||
obj_cs : dict[str, Any] = g_update_prefix | {'type': 'status', 'link' : link, 'status': None, 'setting': None}
|
||||
for obj in values:
|
||||
if obj.is_status:
|
||||
obj_cs['status'] = obj.status
|
||||
else:
|
||||
obj_cs['setting'] = obj.setting
|
||||
cs.append(obj_cs)
|
||||
return cs
|
||||
|
||||
|
||||
def inp_in_status_new(line: str) -> str:
|
||||
def inp_in_status(line: str) -> str:
|
||||
tokens = line.split()
|
||||
|
||||
num = len(tokens)
|
||||
|
||||
Reference in New Issue
Block a user