Luci-Code-Tools 2.1.5__tar.gz → 2.1.6__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Luci-Code-Tools
3
- Version: 2.1.5
3
+ Version: 2.1.6
4
4
  Summary: 一个简单的工具库 / A Eazy Tools Module
5
5
  Home-page: https://github.com/Luci-Code-2014
6
6
  Author: Luci_Code
@@ -55,7 +55,7 @@ Dynamic: summary
55
55
  ## ✨ 特性
56
56
 
57
57
  - 🎨 **ANSI 真彩色** + RGB 支持, 想要什么颜色就什么颜色
58
- - 🛡️ **20+ 异常处理**
58
+ - 🛡️ **5+ 异常处理**
59
59
  - 🌐 **中英双语**, 谁都能看懂错误信息
60
60
  - 🐧 **跨平台**, 支持: Windows / macOS / Linux / Android
61
61
  - 📝 **注释比代码还多**, 不怕看不懂
@@ -110,7 +110,7 @@ cl("字符输出", 32, None, 1)
110
110
 
111
111
  ## 📃 许可证
112
112
 
113
- MIT Licence (c) Luci_Code
113
+ MIT Licence (c) Luci_Code 2026
114
114
 
115
115
  ---
116
116
 
@@ -314,7 +314,7 @@ line = 3 : [
314
314
  ## ✨ Features
315
315
 
316
316
  - 🎨 **ANSI True Color** + RGB support—pick any color you desire!
317
- - 🛡️ **20+ Exception Handlers**
317
+ - 🛡️ **5+ Exception Handlers**
318
318
  - 🌐 **Bilingual Support (Chinese/English)**—everyone can understand the error messages
319
319
  - 🐧 **Cross-Platform**—supports: Windows / macOS / Linux / Android
320
320
  - 📝 **More Comments Than Code**—no need to worry about not understanding it
@@ -369,7 +369,7 @@ cl("Character Output", 32, None, 1)
369
369
 
370
370
  ## 📃 License
371
371
 
372
- MIT License (c) Luci_Code
372
+ MIT License (c) Luci_Code 2026
373
373
 
374
374
  ---
375
375
 
@@ -388,27 +388,32 @@ MIT License (c) Luci_Code
388
388
 
389
389
  # Parameter Usage Guide
390
390
 
391
- **line** refers to whether an additional line break is added after the output; it defaults to `True` (adding an extra line).
391
+ **line** specifies the number of additional lines to output beyond the default; the default value is 2 (resulting in one extra line).
392
392
 
393
- ***Output Effect:***
393
+ ***Output Examples:***
394
394
 
395
- - `line=True`:
395
+ line = 1 : [
396
+ content1
397
+ content2
398
+ input: Luci
399
+ ]
396
400
 
397
- content-1 (Here, this implies `False`)
398
- content-2
401
+ line = 2 : [
402
+ content1 (line = 1)
403
+ content2
399
404
 
400
- input: content
405
+ input: Luci
406
+ ]
401
407
 
402
- if-content-prompt
408
+ line = 3 : [
409
+ content1 (line = 1)
410
+ content2
403
411
 
404
- - `line=False`:
405
412
 
406
- content-1
407
- content-2
408
- input: content
409
- if-content-prompt
413
+ input: Luci
414
+ ]
410
415
 
411
- **This modification makes the command-line output more visually distinct and sophisticated.**
416
+ **This modification makes the command-line output more visually distinct.**
412
417
 
413
418
  **data** and **prompt** both refer to the *text being output*.
414
419
 
@@ -5,13 +5,14 @@ import shutil
5
5
  import os
6
6
 
7
7
  if os.name == "nt": # 系统名称 = "nt" 为 Windows
8
- os.system("") # 激活 win10 / win7 的终端彩色显示功能
8
+ os.system("") # 激活 win10 / win7 的终端彩色显示功能, 只是为了兼容 cmd , powershell 这类不支持彩色的终端
9
9
 
10
- __version__ = "2.1.5" # 明确版本号
10
+ __version__ = "2.1.6" # 明确版本号
11
11
  __all__ = [
12
12
  'color', 'color_rgb', 'clear_screen',
13
13
  'safe_input', 'safe_int', 'safe_float'
14
- ] # 确定导出后的代码可用的函数
14
+ ] # 用户可用函数
15
+
15
16
 
16
17
  class _AnsiCode: # AnsiCode 类
17
18
  ESC = "\033"
@@ -29,7 +30,8 @@ class _AnsiCode: # AnsiCode 类
29
30
  return f"{_AnsiCode.ESC}[{';'.join(parts)}m"
30
31
  return ""
31
32
 
32
- def _ansi_return(data: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0) -> str: # 6767676767 ! 🐱
33
+
34
+ def _ansi_return(data: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0) -> str:
33
35
  """ 生成ANSI彩色文本(不自动输出)
34
36
 
35
37
  参数:
@@ -111,7 +113,7 @@ def clear_screen() -> None: # 清屏: 兼容版
111
113
  except: # 为了防止用户让终端的长度无法获取
112
114
  print("\n" * 250) # 防止获取不到终端长度的输出
113
115
 
114
- def _safe_try_except(prompt, input_type = True, convert_func=None, text_color=None, bg_color=None, mode=0) -> Union[str, int, float]: # True = input 模式 : False = int / float 模式
116
+ def _safe_try_except(prompt, input_type=True, convert_func=None, text_color=None, bg_color=None, mode=0) -> Union[str, int, float]: # True = input 模式 : False = int / float 模式
115
117
  if text_color is not None or bg_color is not None:
116
118
  prompt = _ansi_return(prompt, text_color, bg_color, mode)
117
119
  while True:
@@ -205,18 +207,19 @@ def _safe_try_except(prompt, input_type = True, convert_func=None, text_color=No
205
207
  continue
206
208
  # 27 个 except
207
209
 
208
- def safe_input(prompt, text_color=None, bg_color=None, mode=0) -> str:
210
+ def safe_input(prompt: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0) -> str:
211
+ """ 安全输入 """
209
212
  return _safe_try_except(prompt, True, None, text_color, bg_color, mode)
210
213
 
211
- def _safe_number(prompt, convert_func, text_color=None, bg_color=None, mode=0) -> Union[int, float]:
214
+ def _safe_number(prompt: str, convert_func: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0):
212
215
  return _safe_try_except(prompt, False, convert_func, text_color, bg_color, mode)
213
216
 
214
217
  def safe_int(prompt: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0) -> int:
215
- """ 安全输出整数 """
218
+ """ 安全输入整数 """
216
219
  return _safe_number(prompt, int, text_color, bg_color, mode)
217
220
 
218
221
  def safe_float(prompt: str, text_color: Optional[int] = None, bg_color: Optional[int] = None, mode: int = 0) -> float:
219
- """ 安全输出浮点数 """
222
+ """ 安全输入浮点数 """
220
223
  return _safe_number(prompt, float, text_color, bg_color, mode)
221
224
 
222
225
  # -- 测试部分 -- #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Luci-Code-Tools
3
- Version: 2.1.5
3
+ Version: 2.1.6
4
4
  Summary: 一个简单的工具库 / A Eazy Tools Module
5
5
  Home-page: https://github.com/Luci-Code-2014
6
6
  Author: Luci_Code
@@ -55,7 +55,7 @@ Dynamic: summary
55
55
  ## ✨ 特性
56
56
 
57
57
  - 🎨 **ANSI 真彩色** + RGB 支持, 想要什么颜色就什么颜色
58
- - 🛡️ **20+ 异常处理**
58
+ - 🛡️ **5+ 异常处理**
59
59
  - 🌐 **中英双语**, 谁都能看懂错误信息
60
60
  - 🐧 **跨平台**, 支持: Windows / macOS / Linux / Android
61
61
  - 📝 **注释比代码还多**, 不怕看不懂
@@ -110,7 +110,7 @@ cl("字符输出", 32, None, 1)
110
110
 
111
111
  ## 📃 许可证
112
112
 
113
- MIT Licence (c) Luci_Code
113
+ MIT Licence (c) Luci_Code 2026
114
114
 
115
115
  ---
116
116
 
@@ -314,7 +314,7 @@ line = 3 : [
314
314
  ## ✨ Features
315
315
 
316
316
  - 🎨 **ANSI True Color** + RGB support—pick any color you desire!
317
- - 🛡️ **20+ Exception Handlers**
317
+ - 🛡️ **5+ Exception Handlers**
318
318
  - 🌐 **Bilingual Support (Chinese/English)**—everyone can understand the error messages
319
319
  - 🐧 **Cross-Platform**—supports: Windows / macOS / Linux / Android
320
320
  - 📝 **More Comments Than Code**—no need to worry about not understanding it
@@ -369,7 +369,7 @@ cl("Character Output", 32, None, 1)
369
369
 
370
370
  ## 📃 License
371
371
 
372
- MIT License (c) Luci_Code
372
+ MIT License (c) Luci_Code 2026
373
373
 
374
374
  ---
375
375
 
@@ -388,27 +388,32 @@ MIT License (c) Luci_Code
388
388
 
389
389
  # Parameter Usage Guide
390
390
 
391
- **line** refers to whether an additional line break is added after the output; it defaults to `True` (adding an extra line).
391
+ **line** specifies the number of additional lines to output beyond the default; the default value is 2 (resulting in one extra line).
392
392
 
393
- ***Output Effect:***
393
+ ***Output Examples:***
394
394
 
395
- - `line=True`:
395
+ line = 1 : [
396
+ content1
397
+ content2
398
+ input: Luci
399
+ ]
396
400
 
397
- content-1 (Here, this implies `False`)
398
- content-2
401
+ line = 2 : [
402
+ content1 (line = 1)
403
+ content2
399
404
 
400
- input: content
405
+ input: Luci
406
+ ]
401
407
 
402
- if-content-prompt
408
+ line = 3 : [
409
+ content1 (line = 1)
410
+ content2
403
411
 
404
- - `line=False`:
405
412
 
406
- content-1
407
- content-2
408
- input: content
409
- if-content-prompt
413
+ input: Luci
414
+ ]
410
415
 
411
- **This modification makes the command-line output more visually distinct and sophisticated.**
416
+ **This modification makes the command-line output more visually distinct.**
412
417
 
413
418
  **data** and **prompt** both refer to the *text being output*.
414
419
 
@@ -33,7 +33,7 @@
33
33
  ## ✨ 特性
34
34
 
35
35
  - 🎨 **ANSI 真彩色** + RGB 支持, 想要什么颜色就什么颜色
36
- - 🛡️ **20+ 异常处理**
36
+ - 🛡️ **5+ 异常处理**
37
37
  - 🌐 **中英双语**, 谁都能看懂错误信息
38
38
  - 🐧 **跨平台**, 支持: Windows / macOS / Linux / Android
39
39
  - 📝 **注释比代码还多**, 不怕看不懂
@@ -88,7 +88,7 @@ cl("字符输出", 32, None, 1)
88
88
 
89
89
  ## 📃 许可证
90
90
 
91
- MIT Licence (c) Luci_Code
91
+ MIT Licence (c) Luci_Code 2026
92
92
 
93
93
  ---
94
94
 
@@ -292,7 +292,7 @@ line = 3 : [
292
292
  ## ✨ Features
293
293
 
294
294
  - 🎨 **ANSI True Color** + RGB support—pick any color you desire!
295
- - 🛡️ **20+ Exception Handlers**
295
+ - 🛡️ **5+ Exception Handlers**
296
296
  - 🌐 **Bilingual Support (Chinese/English)**—everyone can understand the error messages
297
297
  - 🐧 **Cross-Platform**—supports: Windows / macOS / Linux / Android
298
298
  - 📝 **More Comments Than Code**—no need to worry about not understanding it
@@ -347,7 +347,7 @@ cl("Character Output", 32, None, 1)
347
347
 
348
348
  ## 📃 License
349
349
 
350
- MIT License (c) Luci_Code
350
+ MIT License (c) Luci_Code 2026
351
351
 
352
352
  ---
353
353
 
@@ -366,27 +366,32 @@ MIT License (c) Luci_Code
366
366
 
367
367
  # Parameter Usage Guide
368
368
 
369
- **line** refers to whether an additional line break is added after the output; it defaults to `True` (adding an extra line).
369
+ **line** specifies the number of additional lines to output beyond the default; the default value is 2 (resulting in one extra line).
370
370
 
371
- ***Output Effect:***
371
+ ***Output Examples:***
372
372
 
373
- - `line=True`:
373
+ line = 1 : [
374
+ content1
375
+ content2
376
+ input: Luci
377
+ ]
374
378
 
375
- content-1 (Here, this implies `False`)
376
- content-2
379
+ line = 2 : [
380
+ content1 (line = 1)
381
+ content2
377
382
 
378
- input: content
383
+ input: Luci
384
+ ]
379
385
 
380
- if-content-prompt
386
+ line = 3 : [
387
+ content1 (line = 1)
388
+ content2
381
389
 
382
- - `line=False`:
383
390
 
384
- content-1
385
- content-2
386
- input: content
387
- if-content-prompt
391
+ input: Luci
392
+ ]
388
393
 
389
- **This modification makes the command-line output more visually distinct and sophisticated.**
394
+ **This modification makes the command-line output more visually distinct.**
390
395
 
391
396
  **data** and **prompt** both refer to the *text being output*.
392
397
 
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
5
5
 
6
6
  setup(
7
7
  name="Luci-Code-Tools",
8
- version="2.1.5",
8
+ version="2.1.6",
9
9
  author="Luci_Code",
10
10
  author_email="3967742419@qq.com",
11
11
  description="一个简单的工具库 / A Eazy Tools Module",
File without changes