uqall: check if % in it before action (performance?)

This commit is contained in:
julius 2022-07-10 02:39:49 +00:00
parent 2aa80f99e8
commit 009c59960c

View File

@ -22,6 +22,7 @@ def uqall(data):
iterator = enumerate(data) iterator = enumerate(data)
elif isinstance(data, dict): elif isinstance(data, dict):
for k in list(data.keys()): for k in list(data.keys()):
if "%" in k:
data[uq(k)] = data.pop(k) data[uq(k)] = data.pop(k)
iterator = data.items() iterator = data.items()
elif isinstance(data, str): elif isinstance(data, str):
@ -33,6 +34,7 @@ def uqall(data):
if isinstance(value, (list, dict)): if isinstance(value, (list, dict)):
uqall(value) uqall(value)
elif isinstance(value, str): elif isinstance(value, str):
if "%" in value:
data[i] = uq(value) data[i] = uq(value)
return data return data