ezKit 1.10.9__py3-none-any.whl → 1.11.0__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 +24 -0
- {ezKit-1.10.9.dist-info → ezKit-1.11.0.dist-info}/METADATA +1 -1
- {ezKit-1.10.9.dist-info → ezKit-1.11.0.dist-info}/RECORD +6 -6
- {ezKit-1.10.9.dist-info → ezKit-1.11.0.dist-info}/LICENSE +0 -0
- {ezKit-1.10.9.dist-info → ezKit-1.11.0.dist-info}/WHEEL +0 -0
- {ezKit-1.10.9.dist-info → ezKit-1.11.0.dist-info}/top_level.txt +0 -0
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
|
@@ -9,10 +9,10 @@ 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
|