ezKit 1.7.3__py3-none-any.whl → 1.7.5__py3-none-any.whl
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/utils.py +37 -5
- {ezKit-1.7.3.dist-info → ezKit-1.7.5.dist-info}/METADATA +2 -2
- {ezKit-1.7.3.dist-info → ezKit-1.7.5.dist-info}/RECORD +6 -6
- {ezKit-1.7.3.dist-info → ezKit-1.7.5.dist-info}/LICENSE +0 -0
- {ezKit-1.7.3.dist-info → ezKit-1.7.5.dist-info}/WHEEL +0 -0
- {ezKit-1.7.3.dist-info → ezKit-1.7.5.dist-info}/top_level.txt +0 -0
ezKit/utils.py
CHANGED
@@ -8,6 +8,7 @@ import json
|
|
8
8
|
import os
|
9
9
|
import subprocess
|
10
10
|
import time
|
11
|
+
import tomllib
|
11
12
|
from copy import deepcopy
|
12
13
|
from multiprocessing import Pool, Process
|
13
14
|
from multiprocessing.pool import ThreadPool
|
@@ -19,7 +20,6 @@ from urllib.parse import ParseResult, urlparse
|
|
19
20
|
from uuid import uuid4
|
20
21
|
|
21
22
|
from loguru import logger
|
22
|
-
from tomlkit import load as toml_load
|
23
23
|
|
24
24
|
# --------------------------------------------------------------------------------------------------
|
25
25
|
|
@@ -799,14 +799,46 @@ def resolve_path() -> str | None:
|
|
799
799
|
return str(Path().resolve())
|
800
800
|
|
801
801
|
|
802
|
-
def parent_path(
|
802
|
+
# def parent_path(
|
803
|
+
# path: str,
|
804
|
+
# debug: bool = False,
|
805
|
+
# **kwargs
|
806
|
+
# ) -> str | None:
|
807
|
+
# """获取父目录名称"""
|
808
|
+
# try:
|
809
|
+
# return str(Path(path, **kwargs).parent.resolve()) if v_true(path, str, debug=debug) else None
|
810
|
+
# except Exception as e:
|
811
|
+
# if v_true(debug, bool):
|
812
|
+
# logger.exception(e)
|
813
|
+
# return None
|
814
|
+
|
815
|
+
|
816
|
+
def current_dir(
|
803
817
|
path: str,
|
804
818
|
debug: bool = False,
|
805
819
|
**kwargs
|
806
820
|
) -> str | None:
|
807
|
-
"""
|
821
|
+
"""获取当前文件所在目录"""
|
808
822
|
try:
|
809
|
-
|
823
|
+
if v_true(path, str, debug=debug) is False:
|
824
|
+
return None
|
825
|
+
return str(Path(path, **kwargs).parent.resolve())
|
826
|
+
except Exception as e:
|
827
|
+
if v_true(debug, bool):
|
828
|
+
logger.exception(e)
|
829
|
+
return None
|
830
|
+
|
831
|
+
|
832
|
+
def parent_dir(
|
833
|
+
path: str,
|
834
|
+
debug: bool = False,
|
835
|
+
**kwargs
|
836
|
+
) -> str | None:
|
837
|
+
"""获取当前文件所在目录的父目录"""
|
838
|
+
try:
|
839
|
+
if v_true(path, str, debug=debug) is False:
|
840
|
+
return None
|
841
|
+
return str(Path(path, **kwargs).parent.parent.resolve())
|
810
842
|
except Exception as e:
|
811
843
|
if v_true(debug, bool):
|
812
844
|
logger.exception(e)
|
@@ -1516,7 +1548,7 @@ def load_toml_file(
|
|
1516
1548
|
if v_true(debug, bool):
|
1517
1549
|
logger.info(f'{info}[执行]')
|
1518
1550
|
with open(file, "rb") as _file:
|
1519
|
-
config =
|
1551
|
+
config = tomllib.load(_file)
|
1520
1552
|
if v_true(debug, bool):
|
1521
1553
|
logger.success(f'{info}[成功]')
|
1522
1554
|
return config
|
@@ -12,11 +12,11 @@ ezKit/redis.py,sha256=pY4SPlcgQ7S8IeY2xoDpxy-xCZxzZQrQJNAoWRsC1dI,1773
|
|
12
12
|
ezKit/reports.py,sha256=dBBggggCCLuk5YD6SjdUPuxTr3wiJojP3lA7dQfg6Pk,8898
|
13
13
|
ezKit/sendemail.py,sha256=AAdxBvEYN_AJVvBkSAvXzhXC5jkbRsD_8P51h2SdTRw,8413
|
14
14
|
ezKit/token.py,sha256=4L6A26KsxvB4WfF8R7SYiBmihJK0PiN5Oh7dgDVJtxU,1382
|
15
|
-
ezKit/utils.py,sha256=
|
15
|
+
ezKit/utils.py,sha256=rTTQwcgMmYwi-TFBwdr4FiawVuOss59DX1mKdmHDM1M,48616
|
16
16
|
ezKit/xftp.py,sha256=qbCqFcGe22TDBSisj0Zoz78tnydDWoOfvywWpXdfaGw,6982
|
17
17
|
ezKit/zabbix.py,sha256=soM5UEeYMfm7NczbPOVLirmHm3G20dECQ0aCBttZfhQ,28350
|
18
|
-
ezKit-1.7.
|
19
|
-
ezKit-1.7.
|
20
|
-
ezKit-1.7.
|
21
|
-
ezKit-1.7.
|
22
|
-
ezKit-1.7.
|
18
|
+
ezKit-1.7.5.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
19
|
+
ezKit-1.7.5.dist-info/METADATA,sha256=hWIBqepDZAuS_xHuQt0C9B5_AbvibiqqUWjW_4icDR0,163
|
20
|
+
ezKit-1.7.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
21
|
+
ezKit-1.7.5.dist-info/top_level.txt,sha256=aYLB_1WODsqNTsTFWcKP-BN0KCTKcV-HZJ4zlHkCFw8,6
|
22
|
+
ezKit-1.7.5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|