1
Fork 0
mirror of https://github.com/RGBCube/JsonWrapper synced 2025-07-27 11:47:45 +00:00
This commit is contained in:
RGBCube 2022-01-21 15:44:54 +03:00 committed by GitHub
parent d5bfff6220
commit fb2df01787
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

11
db.py
View file

@ -19,15 +19,10 @@ class Utils:
@staticmethod @staticmethod
def set(main_dict: dict, path: str, *, key: str, value): def set(main_dict: dict, path: str, *, key: str, value):
def magic(alt_dict: dict, key: str): def magic(alt_dict: dict, key: str):
if key in alt_dict.keys(): if key in alt_dict.keys() and isinstance(alt_dict[key], dict):
if isinstance(alt_dict[key], dict):
return alt_dict
else:
alt_dict[key] = {}
return alt_dict
else:
alt_dict[key] = {}
return alt_dict return alt_dict
alt_dict[key] = {}
return alt_dict
main_dict_ref, i = main_dict, 0 main_dict_ref, i = main_dict, 0
for dict_name in path.split("+"): for dict_name in path.split("+"):
i += 1 i += 1