ezKit 1.10.9__py3-none-any.whl → 1.11.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -394,26 +418,19 @@ def list_print_by_step(
394
418
 
395
419
  try:
396
420
 
397
- # result: list = []
398
-
399
- # if len(data) <= step:
400
- # result.append(data)
401
- # else:
402
- # data_list = list_split(data, step, debug=debug)
403
- # if data_list is None or isTrue(data_list, list) is False:
404
- # return False
405
- # result = data_list
406
-
407
- # for item in result:
408
- # print(*item, sep=separator)
409
-
410
- # return True
411
-
412
421
  # 打印
413
422
  for i, v in enumerate(data):
423
+
414
424
  if i > 0 and i % step == 0:
415
425
  print()
416
- print(v, end=separator)
426
+
427
+ # print(v, end=separator)
428
+
429
+ # 每行最后一个 或者 所有数据最后一个, 不打印分隔符
430
+ if ((i % step) == (step - 1)) or ((i + 1) == len(data)):
431
+ print(v, end='')
432
+ else:
433
+ print(v, end=separator)
417
434
 
418
435
  print()
419
436
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ezKit
3
- Version: 1.10.9
3
+ Version: 1.11.1
4
4
  Summary: Easy Kit
5
5
  Author: septvean
6
6
  Author-email: septvean@gmail.com
@@ -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=YE8JFePsnWYxne_a70jwr26Wc04-0sAFHk0LNOXpEJA,41906
12
+ ezKit/utils.py,sha256=a2RiwOjO83Wi4GmyBRLI1UreaVgNLL66Snbq0HnI37c,42501
13
13
  ezKit/xftp.py,sha256=XyIdr_2rxRVLqPofG6fIYWhAMVsFwTyp46dg5P9FLW4,7774
14
- ezKit-1.10.9.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
15
- ezKit-1.10.9.dist-info/METADATA,sha256=0OJjFfx6zjQTU1SOqFQWc7jE5CNWmcE3qD1fVy114R8,191
16
- ezKit-1.10.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
- ezKit-1.10.9.dist-info/top_level.txt,sha256=aYLB_1WODsqNTsTFWcKP-BN0KCTKcV-HZJ4zlHkCFw8,6
18
- ezKit-1.10.9.dist-info/RECORD,,
14
+ ezKit-1.11.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
15
+ ezKit-1.11.1.dist-info/METADATA,sha256=yJa5E_HlQaNWl0vp7gHIS1c_NalJnQtTvO9nzQK4mpU,191
16
+ ezKit-1.11.1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
+ ezKit-1.11.1.dist-info/top_level.txt,sha256=aYLB_1WODsqNTsTFWcKP-BN0KCTKcV-HZJ4zlHkCFw8,6
18
+ ezKit-1.11.1.dist-info/RECORD,,
File without changes