funcguard 0.1.6__py3-none-any.whl → 0.1.7__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.

Potentially problematic release.


This version of funcguard might be problematic. Click here for more details.

funcguard/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from .core import timeout_handler, retry_function
2
2
  from .tools import send_request, time_log, time_diff
3
- from .printer import print_block, print_line
3
+ from .printer import print_block, print_line, print_title
4
4
 
5
5
  __author__ = "ruocen"
6
6
 
@@ -13,4 +13,5 @@ __all__ = [
13
13
  "time_diff",
14
14
  "print_block",
15
15
  "print_line",
16
+ "print_title",
16
17
  ]
funcguard/printer.py CHANGED
@@ -1,5 +1,18 @@
1
1
  from typing import Any
2
2
 
3
+ # 打印带等号的标题(如:=== 初始化分类器 ===)
4
+ def print_title(title: str, separator_char: str = "=", padding_length: int = 3) -> None:
5
+ """
6
+ 打印带分隔符的标题,格式如:=== 初始化分类器 ===
7
+
8
+ :param title: 标题内容
9
+ :param separator_char: 分隔符字符,默认为'='
10
+ :param padding_length: 标题两侧的分隔符数量,默认为3
11
+ """
12
+ separator = separator_char * padding_length
13
+ print(f"{separator} {title} {separator}")
14
+
15
+
3
16
  # 打印分隔线
4
17
  def print_line(separator_char: str = "-", separator_length: int = 40) -> None:
5
18
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: funcguard
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
4
  Summary: FuncGuard是一个Python库,提供函数执行超时控制、重试机制、HTTP请求封装和格式化打印工具。
5
5
  Home-page: https://github.com/tinycen/funcguard
6
6
  Author: tinycen
@@ -111,10 +111,14 @@ print(response)
111
111
 
112
112
  ### 格式化打印
113
113
 
114
- 使用`print_line`和`print_block`函数进行格式化打印,便于查看和调试:
114
+ 使用`print_line`、`print_block`和`print_title`函数进行格式化打印,便于查看和调试:
115
115
 
116
116
  ```python
117
- from funcguard import print_line, print_block
117
+ from funcguard import print_line, print_block, print_title
118
+
119
+ # 打印带等号的标题
120
+ print_title("初始化分类器") # 输出:=== 初始化分类器 ===
121
+ print_title("训练完成", separator_char="*", padding_length=2) # 输出:** 训练完成 **
118
122
 
119
123
  # 打印分隔线
120
124
  print_line() # 默认使用40个'-'字符
@@ -253,6 +257,15 @@ for i in range(1, 101):
253
257
  - **返回值**: 无
254
258
  - **功能**: 打印分隔线,用于分隔不同的打印块
255
259
 
260
+ #### print_title(title: str, separator_char: str = "=", padding_length: int = 3) -> None
261
+
262
+ - **参数**:
263
+ - `title`: 标题内容
264
+ - `separator_char`: 分隔符字符,默认为'='
265
+ - `padding_length`: 标题两侧的分隔符数量,默认为3
266
+ - **返回值**: 无
267
+ - **功能**: 打印带分隔符的标题,格式如:=== 初始化分类器 ===
268
+
256
269
  #### print_block(title: str, content: Any, separator_char: str = "-", separator_length: int = 40) -> None
257
270
 
258
271
  - **参数**:
@@ -1,13 +1,13 @@
1
- funcguard/__init__.py,sha256=iyM7STP-KSxUn7PUaBWEQcZus2XskiGTTweI4qjoETE,342
1
+ funcguard/__init__.py,sha256=l8GqIAv1jbaq4fLEYsfrfm4Epk8EUoP1BfvwCdwr0Zw,374
2
2
  funcguard/core.py,sha256=-rFRkE-udxM0wxlcv9Qi_yIQBRdVrGgwza-LYQsVRLg,3632
3
- funcguard/printer.py,sha256=c93x6Z-6a7nnead_Rk_f0Xe23kdVdSj4qaxsuBMKfd0,958
3
+ funcguard/printer.py,sha256=Iig_UO4h5LcL0BqCEEdxiu32h4rUq9GJbmf1pC_hd7o,1462
4
4
  funcguard/tools.py,sha256=YIrr1qFWEU61R5Plk5UXGAyp9yGJrm28-POhNsttZsg,5623
5
5
  tests/__init__.py,sha256=VW6FdWdSC_PL3zEtpkRQfUMf6yVD2OfwtSds82jawTs,26
6
6
  tests/run_test.py,sha256=-SLdUV7gDifLxuCCAlU8qLxYMx6KpK4cxfG4UYfUIgA,1005
7
7
  tests/test_core.py,sha256=aZNbQK4eTnnkCI4c2txYZNTcYIUhSJvII5Dvn0vNJKo,3732
8
8
  tests/test_tools.py,sha256=g9dK-WW1s5SIobscRuelufBfPrSgNLZU8d1AJteBpd0,5609
9
- funcguard-0.1.6.dist-info/LICENSE,sha256=jgOquECfjiXp5xXQ2zuzItDr4XDBLan-bIzIXl1lS4Y,1064
10
- funcguard-0.1.6.dist-info/METADATA,sha256=sT6MGwKqp1CyIaKpsmOdzWC7eg-16FOsUMG4XF3t4bM,7723
11
- funcguard-0.1.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
12
- funcguard-0.1.6.dist-info/top_level.txt,sha256=7wL9mWT062DttKNO7Wi1wYWTZilR2AOPRO0rE3gvtB4,16
13
- funcguard-0.1.6.dist-info/RECORD,,
9
+ funcguard-0.1.7.dist-info/LICENSE,sha256=jgOquECfjiXp5xXQ2zuzItDr4XDBLan-bIzIXl1lS4Y,1064
10
+ funcguard-0.1.7.dist-info/METADATA,sha256=xx4YUVNhJ0F--Cmjm9eUAzxE-LNchoBnuuyeZ0kbw1Y,8304
11
+ funcguard-0.1.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
12
+ funcguard-0.1.7.dist-info/top_level.txt,sha256=7wL9mWT062DttKNO7Wi1wYWTZilR2AOPRO0rE3gvtB4,16
13
+ funcguard-0.1.7.dist-info/RECORD,,