1
Fork 0
mirror of https://github.com/RGBCube/JsonWrapper synced 2025-07-27 11:47:45 +00:00

huge mistake reverted & no exec

This commit is contained in:
RGBCube 2022-01-15 16:24:29 +03:00 committed by GitHub
parent c06b88c1a0
commit 6c23b42f71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

11
db.py
View file

@ -20,13 +20,12 @@ class Utils:
else:
alt_dict[key] = {}
return alt_dict
exec_str = "main_dict"
main_dict_ref = main_dict
for dict_name in path.split("+"):
exec_str = f"magic({exec_str}, '{dict_name}')['{dict_name}']"
if path.index(dict_name) == len(path) - 1:
exec_str = f"{exec_str}['{key}'] = {value}"
exec(exec_str)
return main_dict
main_dict = magic(main_dict, dict_name)[dict_name]
if path.split("+").index(dict_name) == len(path.split("+")) - 1:
main_dict[key] = value
return main_dict_ref
class ClutterDB: