ezKit 1.10.8__py3-none-any.whl → 1.11.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- ezKit/database.py +3 -3
- ezKit/utils.py +24 -0
- {ezKit-1.10.8.dist-info → ezKit-1.11.0.dist-info}/METADATA +1 -1
- {ezKit-1.10.8.dist-info → ezKit-1.11.0.dist-info}/RECORD +7 -7
- {ezKit-1.10.8.dist-info → ezKit-1.11.0.dist-info}/LICENSE +0 -0
- {ezKit-1.10.8.dist-info → ezKit-1.11.0.dist-info}/WHEEL +0 -0
- {ezKit-1.10.8.dist-info → ezKit-1.11.0.dist-info}/top_level.txt +0 -0
ezKit/database.py
CHANGED
@@ -44,9 +44,9 @@ class Database():
|
|
44
44
|
info = "Database connect test"
|
45
45
|
try:
|
46
46
|
logger.info(f"{info} ......")
|
47
|
-
self.engine.connect()
|
48
|
-
|
49
|
-
|
47
|
+
with self.engine.connect() as _:
|
48
|
+
logger.success(f"{info} [success]")
|
49
|
+
return True
|
50
50
|
except Exception as e:
|
51
51
|
logger.error(f"{info} [failed]")
|
52
52
|
logger.exception(e)
|
ezKit/utils.py
CHANGED
@@ -235,6 +235,30 @@ def division(
|
|
235
235
|
# --------------------------------------------------------------------------------------------------
|
236
236
|
|
237
237
|
|
238
|
+
def format_float(number: float | int, index: int = 2, limit: int = 3) -> float | None:
|
239
|
+
"""格式化浮点数"""
|
240
|
+
|
241
|
+
# 以两位和三位为例, 如果结果为假, 即: 0, 0.0, 0.00 等,保留小数点后的三位, 否则保留小数点后的两位.
|
242
|
+
|
243
|
+
# 检查参数
|
244
|
+
if not check_arguments([
|
245
|
+
(number, (float, int), "number"),
|
246
|
+
(index, int, "index"),
|
247
|
+
(limit, int, "limit")
|
248
|
+
]):
|
249
|
+
return False
|
250
|
+
|
251
|
+
try:
|
252
|
+
rounded_float = round(number, index)
|
253
|
+
return rounded_float if bool(rounded_float) else round(number, limit)
|
254
|
+
except Exception as e:
|
255
|
+
logger.exception(e)
|
256
|
+
return None
|
257
|
+
|
258
|
+
|
259
|
+
# --------------------------------------------------------------------------------------------------
|
260
|
+
|
261
|
+
|
238
262
|
def check_file_type(
|
239
263
|
file_object: str,
|
240
264
|
file_type: str
|
@@ -2,17 +2,17 @@ ezKit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
ezKit/bottle.py,sha256=usKK1wVaZw4_D-4VwMYmOIc8jtz4TrpM30nck59HMFw,180178
|
3
3
|
ezKit/bottle_extensions.py,sha256=3reEQVZuHklXTl6r7F8kiBFFPb0RaAGc3mYJJnrMDjQ,1129
|
4
4
|
ezKit/cipher.py,sha256=0T_StbjiNI4zgrjVgcfU-ffKgu1waBA9UDudAnqFcNM,2896
|
5
|
-
ezKit/database.py,sha256=
|
5
|
+
ezKit/database.py,sha256=r5YNoEzeOeVTlEWI99xXtHTmPZ73_DopS8DTzZk8Lts,12432
|
6
6
|
ezKit/http.py,sha256=ysXzqXFi9zmuVKINbYGwmf9Q5xDVW_DZWrSh6HSVq8M,1800
|
7
7
|
ezKit/mongo.py,sha256=l3jRMmoGrTm16OG4daSCn0JLU1nbYAmTtHokwjLXzoA,2390
|
8
8
|
ezKit/qywx.py,sha256=X_H4fzP-iEqeDEbumr7D1bXi6dxczaxfO8iyutzy02s,7171
|
9
9
|
ezKit/redis.py,sha256=tdiqfizPYQQTIUumkJGUJsJVlv0zVTSTYGQN0QutYs4,1963
|
10
10
|
ezKit/sendemail.py,sha256=tRXCsJm_RfTJ9xEWe_lTQ5kOs2JxHGPXvq0oWA7prq0,7263
|
11
11
|
ezKit/token.py,sha256=HKREyZj_T2S8-aFoFIrBXTaCKExQq4zE66OHXhGHqQg,1750
|
12
|
-
ezKit/utils.py,sha256=
|
12
|
+
ezKit/utils.py,sha256=CeRFReOm3afxRYkqaVXWv1x4eKXB1YiHnbeGBxvWhKs,42657
|
13
13
|
ezKit/xftp.py,sha256=XyIdr_2rxRVLqPofG6fIYWhAMVsFwTyp46dg5P9FLW4,7774
|
14
|
-
ezKit-1.
|
15
|
-
ezKit-1.
|
16
|
-
ezKit-1.
|
17
|
-
ezKit-1.
|
18
|
-
ezKit-1.
|
14
|
+
ezKit-1.11.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
15
|
+
ezKit-1.11.0.dist-info/METADATA,sha256=qSEnzYClSlWB_0w9rYxDuVD-tc9Y7hPIv_sw3GuXo8g,191
|
16
|
+
ezKit-1.11.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
17
|
+
ezKit-1.11.0.dist-info/top_level.txt,sha256=aYLB_1WODsqNTsTFWcKP-BN0KCTKcV-HZJ4zlHkCFw8,6
|
18
|
+
ezKit-1.11.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|