byzh-core 0.0.2.15__tar.gz → 0.0.3.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.
Files changed (36) hide show
  1. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/PKG-INFO +1 -1
  2. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/B_os.py +12 -2
  3. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Barchive/archive.py +17 -8
  4. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Btable/auto_table.py +0 -1
  5. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Butils/__init__.py +3 -1
  6. byzh_core-0.0.3.0/byzh_core/Butils/decorator.py +15 -0
  7. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Butils/timer.py +4 -0
  8. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Bwriter/writer.py +4 -1
  9. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/__init__.py +1 -1
  10. byzh_core-0.0.3.0/byzh_core/__main__.py +9 -0
  11. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core.egg-info/PKG-INFO +1 -1
  12. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core.egg-info/SOURCES.txt +1 -0
  13. byzh_core-0.0.3.0/byzh_core.egg-info/entry_points.txt +2 -0
  14. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/setup.py +1 -1
  15. byzh_core-0.0.2.15/byzh_core/__main__.py +0 -10
  16. byzh_core-0.0.2.15/byzh_core.egg-info/entry_points.txt +0 -2
  17. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/LICENSE +0 -0
  18. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/README.md +0 -0
  19. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Barchive/__init__.py +0 -0
  20. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Btable/__init__.py +0 -0
  21. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Bterminal/__init__.py +0 -0
  22. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Bterminal/cmd.py +0 -0
  23. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Btqdm/__init__.py +0 -0
  24. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Btqdm/my_tqdm.py +0 -0
  25. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Butils/text_style.py +0 -0
  26. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/Bwriter/__init__.py +0 -0
  27. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/obsolete/Bconfig/__init__.py +0 -0
  28. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/obsolete/Bconfig/config.py +0 -0
  29. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/obsolete/__init__.py +0 -0
  30. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/obsolete/auto_table.py +0 -0
  31. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/obsolete/row_table.py +0 -0
  32. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core/obsolete/xy_table.py +0 -0
  33. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core.egg-info/dependency_links.txt +0 -0
  34. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core.egg-info/requires.txt +0 -0
  35. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/byzh_core.egg-info/top_level.txt +0 -0
  36. {byzh_core-0.0.2.15 → byzh_core-0.0.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh_core
3
- Version: 0.0.2.15
3
+ Version: 0.0.3.0
4
4
  Summary: byzh_core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -1,9 +1,13 @@
1
1
  import shutil
2
2
  import os
3
3
  from pathlib import Path
4
- from typing import Literal
5
4
 
6
- def get_parent_dir(path: Literal['__file__']) -> Path:
5
+ from .Butils import b_validate_params
6
+
7
+ @b_validate_params({
8
+ "path": __file__
9
+ })
10
+ def get_parent_dir(path) -> Path:
7
11
  '''
8
12
  获取 该py文件 所在的文件夹
9
13
  :param path: __file__
@@ -94,6 +98,12 @@ def get_filepaths_in_dir(root_dir_path, exclude_name=[], exclude_suffix=['.pyc']
94
98
  file_paths.append(file_path)
95
99
  return file_paths
96
100
 
101
+ @b_validate_params({
102
+ "black_dirnames": {"examples": ["__pycache__", ".git"]},
103
+ "black_filenames": {"examples": ["__init__.py", "test.py"]},
104
+ "black_stems": {"examples": ["test", "example"]},
105
+ "black_exts": {"examples": [".pyc"]}
106
+ })
97
107
  def walk(
98
108
  root: str,
99
109
  black_dirnames: list[str] = None,
@@ -3,9 +3,18 @@ import zipfile
3
3
  import time
4
4
  from pathlib import Path
5
5
 
6
- from ..Btqdm import B_Tqdm
7
6
  from .. import B_os
8
-
7
+ from ..Btqdm import B_Tqdm
8
+ from ..Butils import b_validate_params
9
+
10
+ @b_validate_params({
11
+ "black_dirnames": {"examples": ["__pycache__", ".git", ".idea"]},
12
+ "black_filenames": {"examples": [".gitignore", "README.md"]},
13
+ "black_stems": {"examples": ["README"]},
14
+ "black_exts": {"examples": [".csv", ".npy", ".pt", ".pth"]},
15
+ "white_filepath": {"examples": ["./.gitignore", "./README.md"]},
16
+ "white_dirpath": {"examples": [r"E:\byzh_workingplace\...\文件夹1"]},
17
+ })
9
18
  def b_archive_zip(
10
19
  source_path,
11
20
  output_path:str|Path=None,
@@ -24,12 +33,12 @@ def b_archive_zip(
24
33
 
25
34
  :param source_path:
26
35
  :param output_path: 如果不传入, 则默认为source_path同名同路径的zip文件
27
- :param black_dirnames: 黑名单-文件夹名 >>> ['__pycache__', '.git', '.idea']
28
- :param black_filenames: 黑名单-文件全名 >>> ['.gitignore', 'README.md']
29
- :param black_stems: 黑名单-文件名(不含后缀) >>> ['README']
30
- :param black_exts: 黑名单-文件后缀(包括.) >>> ['.csv', '.npy', '.pt', '.pth']
31
- :param white_filepath: 白名单-文件全名 >>> ['.gitignore', 'README.md']
32
- :param white_dirpath: 白名单-文件夹路径 >>> ['E:\byzh_workingplace\byzh-rc-to-pypi\big_work\文件夹1']
36
+ :param black_dirnames: 黑名单-文件夹名
37
+ :param black_filenames: 黑名单-文件全名
38
+ :param black_stems: 黑名单-文件名(不含后缀)
39
+ :param black_exts: 黑名单-文件后缀(包括.)
40
+ :param white_filepath: 白名单-文件全名
41
+ :param white_dirpath: 白名单-文件夹路径
33
42
  :param contain_empty_folder: 是否包含空文件夹
34
43
  :return:
35
44
  '''
@@ -1,5 +1,4 @@
1
1
  import copy
2
- import math
3
2
  import os
4
3
  from pathlib import Path
5
4
  from typing import List, Tuple, Union
@@ -1,7 +1,9 @@
1
1
  from .text_style import B_Color, B_Appearance, B_Background
2
2
  from .timer import B_Timer
3
+ from .decorator import b_validate_params
3
4
 
4
5
  __all__ = [
5
6
  'B_Color', 'B_Appearance', 'B_Background',
6
- 'B_Timer'
7
+ 'B_Timer',
8
+ 'b_validate_params'
7
9
  ]
@@ -0,0 +1,15 @@
1
+ def b_validate_params(specs): # specs是@validate_params()传入的内容
2
+ '''
3
+ >>> @b_validate_params({
4
+ >>> "my_str": {"literal": "happy" or "sad"},
5
+ >>> "my_int": {"example": 114514}
6
+ >>> })
7
+ >>> def awa(my_str, my_int):
8
+ >>> return "qwq"
9
+ '''
10
+ def decorator(func): # func是调用修饰器的函数本身
11
+ def wrapper(*args, **kwargs): # *args, **kwargs是函数本身收到的参数
12
+ ...
13
+ return func(*args, **kwargs) # 在此处真正调用函数本身
14
+ return wrapper
15
+ return decorator
@@ -1,6 +1,10 @@
1
1
  import time
2
2
  class B_Timer:
3
3
  def __init__(self):
4
+ '''
5
+ >>> with B_Timer():
6
+ >>> ...
7
+ '''
4
8
  self.start_time = 0
5
9
  self.end_time = 0
6
10
 
@@ -107,4 +107,7 @@ class B_Writer:
107
107
  os.makedirs(dir, exist_ok=True)
108
108
 
109
109
  def __exit__(self):
110
- self.closeFile()
110
+ self.closeFile()
111
+
112
+ if __name__ == '__main__':
113
+ B_Writer()
@@ -2,4 +2,4 @@
2
2
  # class 以"B_"开头
3
3
  # function 以"b_"开头
4
4
 
5
- __version__ = '0.0.2.15'
5
+ __version__ = '0.0.3.0'
@@ -0,0 +1,9 @@
1
+ import argparse
2
+
3
+ def b_zip():
4
+ parser = argparse.ArgumentParser()
5
+ parser.add_argument("dir_path")
6
+ args = parser.parse_args()
7
+
8
+ from .Barchive import b_archive_zip
9
+ b_archive_zip(args.dir_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh_core
3
- Version: 0.0.2.15
3
+ Version: 0.0.3.0
4
4
  Summary: byzh_core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -19,6 +19,7 @@ byzh_core/Bterminal/cmd.py
19
19
  byzh_core/Btqdm/__init__.py
20
20
  byzh_core/Btqdm/my_tqdm.py
21
21
  byzh_core/Butils/__init__.py
22
+ byzh_core/Butils/decorator.py
22
23
  byzh_core/Butils/text_style.py
23
24
  byzh_core/Butils/timer.py
24
25
  byzh_core/Bwriter/__init__.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ byzh = byzh_core.__main__:b_zip
@@ -14,7 +14,7 @@ setup(
14
14
  ],
15
15
  entry_points={
16
16
  "console_scripts": [
17
- "byzh=byzh_core.__main__:main"
17
+ "byzh=byzh_core.__main__:b_zip" # b_zip 路径
18
18
  ]
19
19
  },
20
20
  )
@@ -1,10 +0,0 @@
1
- import argparse
2
-
3
- def main():
4
- parser = argparse.ArgumentParser(description="打个招呼的命令行工具")
5
- parser.add_argument("name", help="你的名字")
6
- parser.add_argument("-t", "--times", type=int, default=1, help="打招呼的次数")
7
- args = parser.parse_args()
8
-
9
- for _ in range(args.times):
10
- print(f"你好,{args.name}!")
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- byzh = byzh_core.__main__:main
File without changes
File without changes
File without changes