Python-json-config-reader 0.0.1__tar.gz → 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/Config_reader.py +7 -9
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/PKG-INFO +1 -1
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/Python_json_config_reader.egg-info/PKG-INFO +1 -1
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/pyproject.toml +1 -1
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/LICENSE +0 -0
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/Python_json_config_reader.egg-info/SOURCES.txt +0 -0
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/Python_json_config_reader.egg-info/dependency_links.txt +0 -0
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/Python_json_config_reader.egg-info/top_level.txt +0 -0
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/README.md +0 -0
- {python_json_config_reader-0.0.1 → python_json_config_reader-0.0.2}/setup.cfg +0 -0
|
@@ -11,7 +11,6 @@ def load_config(path: str):
|
|
|
11
11
|
loaded_data = yaml.safe_load(context)
|
|
12
12
|
else:
|
|
13
13
|
print("Error file type")
|
|
14
|
-
if not loaded_data: raise FileNotFoundError()
|
|
15
14
|
return loaded_data
|
|
16
15
|
except FileNotFoundError:
|
|
17
16
|
dump_config(path, {})
|
|
@@ -20,20 +19,19 @@ def load_config(path: str):
|
|
|
20
19
|
|
|
21
20
|
def dump_config(path: str, data: dict):
|
|
22
21
|
try:
|
|
22
|
+
#
|
|
23
|
+
dictionary = path.replace("\\","/")
|
|
24
|
+
dictionary = dictionary.split("/")
|
|
25
|
+
dictionary = ''.join(dictionary[:-1])
|
|
26
|
+
if not os.path.exists(dictionary):
|
|
27
|
+
os.makedirs(dictionary)
|
|
28
|
+
#
|
|
23
29
|
with open(path, "w", encoding="utf-8") as file:
|
|
24
30
|
if path[-4:] == "json":
|
|
25
31
|
file.write(_dict_to_json(data))
|
|
26
32
|
elif path[-4:] == "yaml":
|
|
27
33
|
yaml.safe_dump(data, file)
|
|
28
34
|
else: print("Error file type")
|
|
29
|
-
except FileNotFoundError:
|
|
30
|
-
dictionary = path.split("/")
|
|
31
|
-
now_path = ""
|
|
32
|
-
for dicts in dictionary[:-1]:
|
|
33
|
-
try: os.mkdir(f"{now_path}{dicts}/")
|
|
34
|
-
except: pass
|
|
35
|
-
now_path+=dicts+"/"
|
|
36
|
-
dump_config(path = path, data = data)
|
|
37
35
|
except: traceback.print_exc()
|
|
38
36
|
|
|
39
37
|
def _dict_to_json(data,level=0):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|