str-processor-Leo-Std 0.1.0__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.
@@ -0,0 +1,53 @@
1
+ Metadata-Version: 2.4
2
+ Name: str-processor-Leo_Std
3
+ Version: 0.1.0
4
+ Summary: A simple string processing utility package for lab experiment
5
+ Author-email: Leo_Std <xinjingyifang@outlook.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+
13
+ # str-processor-yourname
14
+ 这是一个用于实验的字符串处理工具包,包含字符统计、文本清洗和凯撒密码功能。
15
+
16
+ ## 安装
17
+ ```bash
18
+ pip install str-processor-yourname
19
+ 文本
20
+
21
+ 编辑
22
+
23
+
24
+
25
+
26
+ **3. `LICENSE`**(直接复制 MIT 许可证文本到该文件,或写一句 `MIT License Copyright (c) 2026 YourName`)
27
+
28
+ > **【📸 截图点 1】**:截图展示你的项目完整目录结构(包含上述所有文件)。
29
+
30
+ ---
31
+
32
+ ### 四、 注册 TestPyPI 账号与申请 API Token
33
+
34
+ *注:为了不影响正式环境,同学间互测强烈建议使用 **TestPyPI**。*
35
+
36
+ 1. 访问 [TestPyPI 注册页](https://test.pypi.org/account/register/) 注册账号。
37
+ 2. 登录后进入 **Account Settings**,开启双因素认证(2FA)。
38
+ 3. 滚动到 **API tokens** 区域,点击 **Add API token**。
39
+ 4. Token 名称随意(如 `lab-upload`),Scope 选择 **Entire account**。
40
+ 5. 点击生成后,**立即复制保存 Token**(以 `pypi-` 开头,页面关闭后无法再次查看)。
41
+
42
+ > **【📸 截图点 2】**:截图展示 TestPyPI 账号设置页面及 API Token 生成成功的界面(注意给 Token 字符串打马赛克)。
43
+
44
+ ---
45
+
46
+ ### 五、 构建与上传包
47
+
48
+ 打开命令行终端(CMD / PowerShell / Terminal),进入项目根目录 `str-processor-yourname/`。
49
+
50
+ **1. 安装构建与上传工具**
51
+
52
+ ```bash
53
+ pip install --upgrade build twine
@@ -0,0 +1,41 @@
1
+ # str-processor-yourname
2
+ 这是一个用于实验的字符串处理工具包,包含字符统计、文本清洗和凯撒密码功能。
3
+
4
+ ## 安装
5
+ ```bash
6
+ pip install str-processor-yourname
7
+ 文本
8
+
9
+ 编辑
10
+
11
+
12
+
13
+
14
+ **3. `LICENSE`**(直接复制 MIT 许可证文本到该文件,或写一句 `MIT License Copyright (c) 2026 YourName`)
15
+
16
+ > **【📸 截图点 1】**:截图展示你的项目完整目录结构(包含上述所有文件)。
17
+
18
+ ---
19
+
20
+ ### 四、 注册 TestPyPI 账号与申请 API Token
21
+
22
+ *注:为了不影响正式环境,同学间互测强烈建议使用 **TestPyPI**。*
23
+
24
+ 1. 访问 [TestPyPI 注册页](https://test.pypi.org/account/register/) 注册账号。
25
+ 2. 登录后进入 **Account Settings**,开启双因素认证(2FA)。
26
+ 3. 滚动到 **API tokens** 区域,点击 **Add API token**。
27
+ 4. Token 名称随意(如 `lab-upload`),Scope 选择 **Entire account**。
28
+ 5. 点击生成后,**立即复制保存 Token**(以 `pypi-` 开头,页面关闭后无法再次查看)。
29
+
30
+ > **【📸 截图点 2】**:截图展示 TestPyPI 账号设置页面及 API Token 生成成功的界面(注意给 Token 字符串打马赛克)。
31
+
32
+ ---
33
+
34
+ ### 五、 构建与上传包
35
+
36
+ 打开命令行终端(CMD / PowerShell / Terminal),进入项目根目录 `str-processor-yourname/`。
37
+
38
+ **1. 安装构建与上传工具**
39
+
40
+ ```bash
41
+ pip install --upgrade build twine
@@ -0,0 +1,19 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "str-processor-Leo_Std" # 【注意】替换为你的唯一包名
7
+ version = "0.1.0"
8
+ authors = [
9
+ {name = "Leo_Std", email = "xinjingyifang@outlook.com"}
10
+ ]
11
+ description = "A simple string processing utility package for lab experiment"
12
+ readme = "README.md"
13
+ license = {text = "MIT"}
14
+ requires-python = ">=3.8"
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ from .core import count_characters, clean_text, caesar_cipher, reverse_words
2
+ from .core import __version__
@@ -0,0 +1,70 @@
1
+ """
2
+ 字符串处理工具包 (str_processor_yourname)
3
+ 提供常用的文本清洗、统计和简单加密功能。
4
+ """
5
+
6
+ __version__ = "0.1.0"
7
+
8
+
9
+ def count_characters(text: str) -> dict:
10
+ """统计字符串中的各类字符数量"""
11
+ if not isinstance(text, str):
12
+ raise TypeError("输入必须是字符串")
13
+
14
+ stats = {
15
+ "total": len(text),
16
+ "letters": 0,
17
+ "digits": 0,
18
+ "spaces": 0,
19
+ "others": 0
20
+ }
21
+
22
+ for char in text:
23
+ if char.isalpha():
24
+ stats["letters"] += 1
25
+ elif char.isdigit():
26
+ stats["digits"] += 1
27
+ elif char.isspace():
28
+ stats["spaces"] += 1
29
+ else:
30
+ stats["others"] += 1
31
+
32
+ return stats
33
+
34
+
35
+ def clean_text(text: str, keep_spaces: bool = True) -> str:
36
+ """清洗文本,去除非字母数字字符"""
37
+ if not isinstance(text, str):
38
+ raise TypeError("输入必须是字符串")
39
+
40
+ cleaned = []
41
+ for char in text:
42
+ if char.isalnum():
43
+ cleaned.append(char)
44
+ elif keep_spaces and char.isspace():
45
+ cleaned.append(" ")
46
+
47
+ return "".join(cleaned).strip()
48
+
49
+
50
+ def caesar_cipher(text: str, shift: int = 3, decrypt: bool = False) -> str:
51
+ """简单的凯撒密码加密/解密"""
52
+ if decrypt:
53
+ shift = -shift
54
+
55
+ result = []
56
+ for char in text:
57
+ if char.isalpha():
58
+ base = ord('A') if char.isupper() else ord('a')
59
+ shifted = (ord(char) - base + shift) % 26 + base
60
+ result.append(chr(shifted))
61
+ else:
62
+ result.append(char)
63
+
64
+ return "".join(result)
65
+
66
+
67
+ def reverse_words(text: str) -> str:
68
+ """反转字符串中的单词顺序"""
69
+ words = text.split()
70
+ return " ".join(reversed(words))
@@ -0,0 +1,53 @@
1
+ Metadata-Version: 2.4
2
+ Name: str-processor-Leo_Std
3
+ Version: 0.1.0
4
+ Summary: A simple string processing utility package for lab experiment
5
+ Author-email: Leo_Std <xinjingyifang@outlook.com>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+
13
+ # str-processor-yourname
14
+ 这是一个用于实验的字符串处理工具包,包含字符统计、文本清洗和凯撒密码功能。
15
+
16
+ ## 安装
17
+ ```bash
18
+ pip install str-processor-yourname
19
+ 文本
20
+
21
+ 编辑
22
+
23
+
24
+
25
+
26
+ **3. `LICENSE`**(直接复制 MIT 许可证文本到该文件,或写一句 `MIT License Copyright (c) 2026 YourName`)
27
+
28
+ > **【📸 截图点 1】**:截图展示你的项目完整目录结构(包含上述所有文件)。
29
+
30
+ ---
31
+
32
+ ### 四、 注册 TestPyPI 账号与申请 API Token
33
+
34
+ *注:为了不影响正式环境,同学间互测强烈建议使用 **TestPyPI**。*
35
+
36
+ 1. 访问 [TestPyPI 注册页](https://test.pypi.org/account/register/) 注册账号。
37
+ 2. 登录后进入 **Account Settings**,开启双因素认证(2FA)。
38
+ 3. 滚动到 **API tokens** 区域,点击 **Add API token**。
39
+ 4. Token 名称随意(如 `lab-upload`),Scope 选择 **Entire account**。
40
+ 5. 点击生成后,**立即复制保存 Token**(以 `pypi-` 开头,页面关闭后无法再次查看)。
41
+
42
+ > **【📸 截图点 2】**:截图展示 TestPyPI 账号设置页面及 API Token 生成成功的界面(注意给 Token 字符串打马赛克)。
43
+
44
+ ---
45
+
46
+ ### 五、 构建与上传包
47
+
48
+ 打开命令行终端(CMD / PowerShell / Terminal),进入项目根目录 `str-processor-yourname/`。
49
+
50
+ **1. 安装构建与上传工具**
51
+
52
+ ```bash
53
+ pip install --upgrade build twine
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/__init__.py
4
+ src/core.py
5
+ src/str_processor_Leo_Std.egg-info/PKG-INFO
6
+ src/str_processor_Leo_Std.egg-info/SOURCES.txt
7
+ src/str_processor_Leo_Std.egg-info/dependency_links.txt
8
+ src/str_processor_Leo_Std.egg-info/top_level.txt