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.
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/Luci_Code_Tools.egg-info/PKG-INFO +23 -18
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/Luci_code_tools.py +12 -9
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/PKG-INFO +23 -18
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/README.md +22 -17
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/setup.py +1 -1
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/LICENCE +0 -0
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/Luci_Code_Tools.egg-info/SOURCES.txt +0 -0
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/Luci_Code_Tools.egg-info/dependency_links.txt +0 -0
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/Luci_Code_Tools.egg-info/top_level.txt +0 -0
- {luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Luci-Code-Tools
|
|
3
|
-
Version: 2.1.
|
|
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
|
-
- 🛡️ **
|
|
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
|
-
- 🛡️ **
|
|
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**
|
|
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
|
|
393
|
+
***Output Examples:***
|
|
394
394
|
|
|
395
|
-
|
|
395
|
+
line = 1 : [
|
|
396
|
+
content1
|
|
397
|
+
content2
|
|
398
|
+
input: Luci
|
|
399
|
+
]
|
|
396
400
|
|
|
397
|
-
|
|
398
|
-
|
|
401
|
+
line = 2 : [
|
|
402
|
+
content1 (line = 1)
|
|
403
|
+
content2
|
|
399
404
|
|
|
400
|
-
input:
|
|
405
|
+
input: Luci
|
|
406
|
+
]
|
|
401
407
|
|
|
402
|
-
|
|
408
|
+
line = 3 : [
|
|
409
|
+
content1 (line = 1)
|
|
410
|
+
content2
|
|
403
411
|
|
|
404
|
-
- `line=False`:
|
|
405
412
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
input: content
|
|
409
|
-
if-content-prompt
|
|
413
|
+
input: Luci
|
|
414
|
+
]
|
|
410
415
|
|
|
411
|
-
**This modification makes the command-line output more visually distinct
|
|
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.
|
|
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
|
-
|
|
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
|
|
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)
|
|
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.
|
|
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
|
-
- 🛡️ **
|
|
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
|
-
- 🛡️ **
|
|
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**
|
|
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
|
|
393
|
+
***Output Examples:***
|
|
394
394
|
|
|
395
|
-
|
|
395
|
+
line = 1 : [
|
|
396
|
+
content1
|
|
397
|
+
content2
|
|
398
|
+
input: Luci
|
|
399
|
+
]
|
|
396
400
|
|
|
397
|
-
|
|
398
|
-
|
|
401
|
+
line = 2 : [
|
|
402
|
+
content1 (line = 1)
|
|
403
|
+
content2
|
|
399
404
|
|
|
400
|
-
input:
|
|
405
|
+
input: Luci
|
|
406
|
+
]
|
|
401
407
|
|
|
402
|
-
|
|
408
|
+
line = 3 : [
|
|
409
|
+
content1 (line = 1)
|
|
410
|
+
content2
|
|
403
411
|
|
|
404
|
-
- `line=False`:
|
|
405
412
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
input: content
|
|
409
|
-
if-content-prompt
|
|
413
|
+
input: Luci
|
|
414
|
+
]
|
|
410
415
|
|
|
411
|
-
**This modification makes the command-line output more visually distinct
|
|
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
|
-
- 🛡️ **
|
|
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
|
-
- 🛡️ **
|
|
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**
|
|
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
|
|
371
|
+
***Output Examples:***
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
line = 1 : [
|
|
374
|
+
content1
|
|
375
|
+
content2
|
|
376
|
+
input: Luci
|
|
377
|
+
]
|
|
374
378
|
|
|
375
|
-
|
|
376
|
-
|
|
379
|
+
line = 2 : [
|
|
380
|
+
content1 (line = 1)
|
|
381
|
+
content2
|
|
377
382
|
|
|
378
|
-
input:
|
|
383
|
+
input: Luci
|
|
384
|
+
]
|
|
379
385
|
|
|
380
|
-
|
|
386
|
+
line = 3 : [
|
|
387
|
+
content1 (line = 1)
|
|
388
|
+
content2
|
|
381
389
|
|
|
382
|
-
- `line=False`:
|
|
383
390
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
input: content
|
|
387
|
-
if-content-prompt
|
|
391
|
+
input: Luci
|
|
392
|
+
]
|
|
388
393
|
|
|
389
|
-
**This modification makes the command-line output more visually distinct
|
|
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
|
|
|
File without changes
|
|
File without changes
|
{luci_code_tools-2.1.5 → luci_code_tools-2.1.6}/Luci_Code_Tools.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|