HOTWORDS yaml @ can have comma delimited and KEYS
parent
a1436e3bd2
commit
b4d3e5a27c
|
|
@ -185,6 +185,8 @@ def _load_dot_notation(v, items):
|
|||
else:
|
||||
result.append(subresult)
|
||||
return result
|
||||
elif k == "KEYS":
|
||||
v = [k for k in v]
|
||||
else:
|
||||
if isinstance(v, list):
|
||||
v = v[int(k)]
|
||||
|
|
@ -229,8 +231,15 @@ class Reactor(threading.Thread):
|
|||
def load_hotwords_in_yaml_file():
|
||||
with open(p.split("@")[0], "r") as f:
|
||||
v = yaml.safe_load(f)
|
||||
v = load_dot_notation(v, p.split("@")[-1])
|
||||
return ["".join(i.strip().lower().split()) for i in v if i]
|
||||
if os.environ.get("DEBUG", None):
|
||||
log(f'opened {p.split("@")[0]} and got {v}')
|
||||
result = []
|
||||
for to_find in [i for i in p.split("@")[-1].split(",") if i]:
|
||||
if os.environ.get("DEBUG", None):
|
||||
log(f'finding {to_find} in {v}')
|
||||
v2 = load_dot_notation(v, to_find)
|
||||
result.extend(["".join(i.strip().lower().split()) for i in v2 if i])
|
||||
return result
|
||||
load_hotwords_in_yaml_file()
|
||||
return load_hotwords_in_yaml_file
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue