Commit 012fc8cd by 岳巧源

add new config

parent 1899007f
import os.path
import json
def load_config() -> str:
current_path = os.path.abspath(__file__)
dir_path = os.path.dirname(current_path)
config_path = os.path.join(os.path.dirname(dir_path), "config.json")
return config_path
CONFIG_PATH = load_config()
__all__ = [
"CONFIG_PATH"
]
from .file_handle import load_json
__all__ = [
"load_json"
]
\ No newline at end of file
import gzip import gzip
import json
import zipfile import zipfile
...@@ -20,3 +21,8 @@ def ungz(file_path: str, save_path: str): ...@@ -20,3 +21,8 @@ def ungz(file_path: str, save_path: str):
g_file = gzip.GzipFile(file_path) g_file = gzip.GzipFile(file_path)
open(save_path + new_file_name, "wb+").write(g_file.read()) open(save_path + new_file_name, "wb+").write(g_file.read())
g_file.close() g_file.close()
def load_json(json_content) -> dict:
"""convert json content to dict"""
return json.loads(json_content)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment