ezKit 2.0.0__tar.gz → 2.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.
- {ezkit-2.0.0/ezKit.egg-info → ezkit-2.0.2}/PKG-INFO +1 -1
- {ezkit-2.0.0 → ezkit-2.0.2}/ezKit/http.py +1 -0
- ezkit-2.0.2/ezKit/utils.py +46 -0
- {ezkit-2.0.0 → ezkit-2.0.2/ezKit.egg-info}/PKG-INFO +1 -1
- {ezkit-2.0.0 → ezkit-2.0.2}/ezKit.egg-info/SOURCES.txt +2 -0
- ezkit-2.0.2/pyproject.toml +19 -0
- {ezkit-2.0.0 → ezkit-2.0.2}/setup.py +1 -1
- {ezkit-2.0.0 → ezkit-2.0.2}/LICENSE +0 -0
- {ezkit-2.0.0 → ezkit-2.0.2}/MANIFEST.in +0 -0
- {ezkit-2.0.0 → ezkit-2.0.2}/README.md +0 -0
- {ezkit-2.0.0 → ezkit-2.0.2}/ezKit/__init__.py +0 -0
- {ezkit-2.0.0 → ezkit-2.0.2}/ezKit/database.py +0 -0
- {ezkit-2.0.0 → ezkit-2.0.2}/ezKit.egg-info/dependency_links.txt +0 -0
- {ezkit-2.0.0 → ezkit-2.0.2}/ezKit.egg-info/requires.txt +0 -0
- {ezkit-2.0.0 → ezkit-2.0.2}/ezKit.egg-info/top_level.txt +0 -0
- {ezkit-2.0.0 → ezkit-2.0.2}/setup.cfg +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Utils Library"""
|
|
2
|
+
|
|
3
|
+
import tomllib
|
|
4
|
+
|
|
5
|
+
from os import environ
|
|
6
|
+
|
|
7
|
+
from loguru import logger
|
|
8
|
+
|
|
9
|
+
# --------------------------------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
DEBUG = environ.get("DEBUG")
|
|
12
|
+
|
|
13
|
+
# --------------------------------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def load_toml_file(file: str) -> dict:
|
|
17
|
+
"""Load TOML file"""
|
|
18
|
+
|
|
19
|
+
info: str = "load toml file"
|
|
20
|
+
|
|
21
|
+
try:
|
|
22
|
+
|
|
23
|
+
logger.info(f"{info} [ start ]")
|
|
24
|
+
|
|
25
|
+
# 不要加 encoding="utf-8" 参数, 否则会报错:
|
|
26
|
+
# binary mode doesn't take an encoding argument
|
|
27
|
+
with open(file, "rb") as _file:
|
|
28
|
+
config = tomllib.load(_file)
|
|
29
|
+
|
|
30
|
+
logger.success(f"{info} [ success ]")
|
|
31
|
+
|
|
32
|
+
return config
|
|
33
|
+
|
|
34
|
+
except Exception as e:
|
|
35
|
+
|
|
36
|
+
logger.error(f"{info} [ error ]")
|
|
37
|
+
|
|
38
|
+
if DEBUG:
|
|
39
|
+
logger.exception(e)
|
|
40
|
+
else:
|
|
41
|
+
logger.error(e)
|
|
42
|
+
|
|
43
|
+
return {}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# --------------------------------------------------------------------------------------------------
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#
|
|
2
|
+
# 标准库
|
|
3
|
+
# import os
|
|
4
|
+
#
|
|
5
|
+
# 第三方库
|
|
6
|
+
# import requests
|
|
7
|
+
#
|
|
8
|
+
# 当前目录
|
|
9
|
+
# import my_module
|
|
10
|
+
# import utils
|
|
11
|
+
#
|
|
12
|
+
[tool.isort]
|
|
13
|
+
profile = "black"
|
|
14
|
+
force_sort_within_sections = false
|
|
15
|
+
lines_between_types = 1
|
|
16
|
+
|
|
17
|
+
# 把当前目录作为“本地应用(first-party)”
|
|
18
|
+
# src_paths = ["./source"]
|
|
19
|
+
# known_first_party = ["./source"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|