pylhb4yaml 1.0.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,25 @@
1
+ Non-Commercial Use License
2
+
3
+ Copyright (c) 2025 Mr.Lee
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software for non-commercial purposes only, including without limitation
8
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
+ and/or sell copies of the Software, subject to the following conditions:
10
+
11
+ 1. The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ 2. Commercial use of the Software is expressly prohibited without prior written
15
+ permission from the copyright holder. For purposes of this license, commercial
16
+ use means any use of the Software that is intended for or directed toward
17
+ commercial advantage or monetary compensation.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
@@ -0,0 +1,70 @@
1
+ Metadata-Version: 2.3
2
+ Name: pylhb4yaml
3
+ Version: 1.0.0
4
+ Summary: Mr.Lee's YAML Helpers
5
+ Author: SoftGod4MrLi
6
+ Author-email: SoftGod4MrLi <596928288@qq.com>
7
+ License: Non-Commercial Use License
8
+
9
+ Copyright (c) 2025 Mr.Lee
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software for non-commercial purposes only, including without limitation
14
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
15
+ and/or sell copies of the Software, subject to the following conditions:
16
+
17
+ 1. The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ 2. Commercial use of the Software is expressly prohibited without prior written
21
+ permission from the copyright holder. For purposes of this license, commercial
22
+ use means any use of the Software that is intended for or directed toward
23
+ commercial advantage or monetary compensation.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
32
+ Requires-Python: >=3.12
33
+ Project-URL: Homepage, https://github.com/SoftGod4MrLi/pylhb4yaml
34
+ Project-URL: Documentation, https://github.com/SoftGod4MrLi/pylhb4yaml
35
+ Project-URL: Repository, https://github.com/SoftGod4MrLi/pylhb4yaml
36
+ Project-URL: Issues, https://github.com/SoftGod4MrLi/pylhb4yaml/issues
37
+ Description-Content-Type: text/markdown
38
+
39
+ # pylhb4yaml
40
+
41
+ [![PyPI version](https://img.shields.io/pypi/v/pylhb4yaml.svg)](https://pypi.org/project/pylhb4yaml/)
42
+ [![GitHub stars](https://img.shields.io/github/stars/SoftGod4MrLi/pylhb4yaml?style=flat&logo=github)](https://github.com/SoftGod4MrLi/pylhb4yaml)
43
+ [![GitHub license](https://img.shields.io/github/license/SoftGod4MrLi/pylhb4yaml?style=flat)](https://github.com/SoftGod4MrLi/pylhb4yaml/blob/main/LICENSE)
44
+ ![GitHub repo size](https://img.shields.io/github/repo-size/SoftGod4MrLi/pylhb4yaml?style=flat)
45
+ [![GitHub forks](https://img.shields.io/github/forks/SoftGod4MrLi/pylhb4yaml?style=flat&logo=github)](https://github.com/SoftGod4MrLi/pylhb4yaml)
46
+
47
+ pylhb4yaml 是我在工作过程中陆续整理的一个 Python YAML 工具包,里面就放在一个关于YAML操作的类及相关函数。与其说是一个正式的开源项目,不如说是我自己的“代码杂物间”——只不过把它打包了一下,方便在不同项目之间复用。
48
+
49
+ > 由于是个人使用为主,很多设计可能带着比较强的个人习惯,也未必是最优解。如果您发现了问题或有更好的建议,非常欢迎指正。
50
+
51
+ ## 安装
52
+
53
+ ```
54
+ pip install pylhb4yaml
55
+ ```
56
+
57
+ ## 🌺myyaml模块
58
+
59
+ YAML读写。
60
+
61
+ 使用示例:
62
+
63
+ ```
64
+ from pylhb4yaml.myyaml import MyYAML
65
+
66
+ if __name__ == "__main__":
67
+ ymal=MyYAML()
68
+ key=ymal.getKey("Key")
69
+ yaml.setKey("Key","Value")
70
+ ```
@@ -0,0 +1,32 @@
1
+ # pylhb4yaml
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/pylhb4yaml.svg)](https://pypi.org/project/pylhb4yaml/)
4
+ [![GitHub stars](https://img.shields.io/github/stars/SoftGod4MrLi/pylhb4yaml?style=flat&logo=github)](https://github.com/SoftGod4MrLi/pylhb4yaml)
5
+ [![GitHub license](https://img.shields.io/github/license/SoftGod4MrLi/pylhb4yaml?style=flat)](https://github.com/SoftGod4MrLi/pylhb4yaml/blob/main/LICENSE)
6
+ ![GitHub repo size](https://img.shields.io/github/repo-size/SoftGod4MrLi/pylhb4yaml?style=flat)
7
+ [![GitHub forks](https://img.shields.io/github/forks/SoftGod4MrLi/pylhb4yaml?style=flat&logo=github)](https://github.com/SoftGod4MrLi/pylhb4yaml)
8
+
9
+ pylhb4yaml 是我在工作过程中陆续整理的一个 Python YAML 工具包,里面就放在一个关于YAML操作的类及相关函数。与其说是一个正式的开源项目,不如说是我自己的“代码杂物间”——只不过把它打包了一下,方便在不同项目之间复用。
10
+
11
+ > 由于是个人使用为主,很多设计可能带着比较强的个人习惯,也未必是最优解。如果您发现了问题或有更好的建议,非常欢迎指正。
12
+
13
+ ## 安装
14
+
15
+ ```
16
+ pip install pylhb4yaml
17
+ ```
18
+
19
+ ## 🌺myyaml模块
20
+
21
+ YAML读写。
22
+
23
+ 使用示例:
24
+
25
+ ```
26
+ from pylhb4yaml.myyaml import MyYAML
27
+
28
+ if __name__ == "__main__":
29
+ ymal=MyYAML()
30
+ key=ymal.getKey("Key")
31
+ yaml.setKey("Key","Value")
32
+ ```
@@ -0,0 +1,24 @@
1
+ [project]
2
+ name = "pylhb4yaml"
3
+ version = "1.0.0"
4
+ description = "Mr.Lee's YAML Helpers"
5
+ readme = "README.md"
6
+ license = {file = "LICENSE"}
7
+ authors = [
8
+ { name = "SoftGod4MrLi", email = "596928288@qq.com" }
9
+ ]
10
+ requires-python = ">=3.12"
11
+ dependencies = []
12
+
13
+ [project.urls]
14
+ Homepage = "https://github.com/SoftGod4MrLi/pylhb4yaml"
15
+ Documentation = "https://github.com/SoftGod4MrLi/pylhb4yaml"
16
+ Repository = "https://github.com/SoftGod4MrLi/pylhb4yaml"
17
+ Issues = "https://github.com/SoftGod4MrLi/pylhb4yaml/issues"
18
+
19
+ [project.scripts]
20
+ pylhb4yaml = "pylhb4yaml:main"
21
+
22
+ [build-system]
23
+ requires = ["uv_build>=0.11.18,<100.12.0"]
24
+ build-backend = "uv_build"
@@ -0,0 +1,27 @@
1
+ import argparse
2
+ # Mr.Lee's Module
3
+ from .myyaml import MyYAML
4
+
5
+ __all__ = [
6
+ "MyYAML"
7
+ ]
8
+
9
+ def main() -> None:
10
+ parser = argparse.ArgumentParser(description="Mr.Lee's YAML Helpers")
11
+ parser.add_argument('-v', '--version', action='store_true', help='show version')
12
+ args = parser.parse_args()
13
+
14
+ # show version
15
+ if args.version:
16
+ try:
17
+ from importlib.metadata import version, PackageNotFoundError
18
+ # 直接从包元数据获取版本号
19
+ ver = version("pylhb4yaml")
20
+ print(f"pylhb4yaml {ver}")
21
+ except PackageNotFoundError:
22
+ print("Package not found.")
23
+ except ImportError:
24
+ print("Import errored.")
25
+ except:
26
+ print("Other errored.")
27
+ return
@@ -0,0 +1,41 @@
1
+ """
2
+ 模块:myyaml
3
+ 作者:李生
4
+ 描述:YAML读写
5
+ """
6
+ import yaml
7
+
8
+ class MyYAML:
9
+ """YAML读写"""
10
+ def __init__(self,yamlFile="config.yaml") -> None:
11
+ """
12
+ Args:
13
+ yamlFile:yaml文件
14
+ """
15
+ self.yamlFile=yamlFile
16
+
17
+ def getKey(self,key):
18
+ """
19
+ 获取Key
20
+ Args:
21
+ key:key
22
+ """
23
+ with open(self.yamlFile,'r',encoding='utf-8') as f:
24
+ configs=yaml.load(f,Loader=yaml.FullLoader)
25
+ return configs[key]
26
+
27
+ def setKey(self,key,value):
28
+ """
29
+ 设置Key
30
+ Args:
31
+ key:key
32
+ value:value
33
+ """
34
+ # 读取
35
+ with open(self.yamlFile,'r',encoding='utf-8') as f:
36
+ configs=yaml.load(f,Loader=yaml.FullLoader)
37
+ # 设置参数
38
+ configs[key]=value
39
+ # 保存
40
+ with open(self.yamlFile, 'w', encoding="utf-8") as f:
41
+ yaml.dump(configs, f)