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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -3,6 +3,7 @@
3
3
  from os import environ
4
4
 
5
5
  import requests
6
+
6
7
  from loguru import logger
7
8
  from requests.adapters import HTTPAdapter
8
9
  from urllib3.util.retry import Retry
@@ -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
+ # --------------------------------------------------------------------------------------------------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ezKit
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -1,10 +1,12 @@
1
1
  LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
+ pyproject.toml
4
5
  setup.py
5
6
  ezKit/__init__.py
6
7
  ezKit/database.py
7
8
  ezKit/http.py
9
+ ezKit/utils.py
8
10
  ezKit.egg-info/PKG-INFO
9
11
  ezKit.egg-info/SOURCES.txt
10
12
  ezKit.egg-info/dependency_links.txt
@@ -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"]
@@ -4,7 +4,7 @@ from setuptools import find_packages, setup
4
4
 
5
5
  setup(
6
6
  name="ezKit",
7
- version="2.0.0",
7
+ version="2.0.2",
8
8
  author="septvean",
9
9
  author_email="septvean@gmail.com",
10
10
  description="Easy Kit",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes