byzh-core 0.0.2.12__tar.gz → 0.0.2.14__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 (33) hide show
  1. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/PKG-INFO +1 -1
  2. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/Barchive/archive.py +5 -3
  3. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/Bterminal/cmd.py +1 -1
  4. byzh_core-0.0.2.14/byzh_core/Btqdm/__init__.py +6 -0
  5. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/Btqdm/my_tqdm.py +12 -6
  6. byzh_core-0.0.2.14/byzh_core/Butils/__init__.py +7 -0
  7. {byzh_core-0.0.2.12/byzh_core/Bbasic → byzh_core-0.0.2.14/byzh_core/Butils}/text_style.py +5 -3
  8. byzh_core-0.0.2.14/byzh_core/Butils/timer.py +17 -0
  9. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/Bwriter/writer.py +1 -1
  10. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/__init__.py +1 -1
  11. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/obsolete/Bconfig/config.py +1 -1
  12. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core.egg-info/PKG-INFO +1 -1
  13. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core.egg-info/SOURCES.txt +3 -2
  14. byzh_core-0.0.2.12/byzh_core/Bbasic/__init__.py +0 -3
  15. byzh_core-0.0.2.12/byzh_core/Btqdm/__init__.py +0 -4
  16. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/LICENSE +0 -0
  17. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/README.md +0 -0
  18. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/B_os.py +0 -0
  19. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/Barchive/__init__.py +0 -0
  20. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/Btable/__init__.py +0 -0
  21. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/Btable/auto_table.py +0 -0
  22. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/Bterminal/__init__.py +0 -0
  23. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/Bwriter/__init__.py +0 -0
  24. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/obsolete/Bconfig/__init__.py +0 -0
  25. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/obsolete/__init__.py +0 -0
  26. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/obsolete/auto_table.py +0 -0
  27. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/obsolete/row_table.py +0 -0
  28. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core/obsolete/xy_table.py +0 -0
  29. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core.egg-info/dependency_links.txt +0 -0
  30. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core.egg-info/requires.txt +0 -0
  31. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/byzh_core.egg-info/top_level.txt +0 -0
  32. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/setup.cfg +0 -0
  33. {byzh_core-0.0.2.12 → byzh_core-0.0.2.14}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh_core
3
- Version: 0.0.2.12
3
+ Version: 0.0.2.14
4
4
  Summary: byzh_core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -20,9 +20,11 @@ def b_archive_zip(
20
20
 
21
21
  :param source_path:
22
22
  :param output_path: 如果不传入, 则默认为source_path同名同路径的zip文件
23
- :param exclude_dirs: ['__pycache__', '.git', '.idea']
24
- :param exclude_files: ['.gitignore', 'README.md']
25
- :param exclude_exts: ['.csv', '.npy', '.pt', '.pth']
23
+ :param exclude_dirs: 黑名单-文件夹名 >>> ['__pycache__', '.git', '.idea']
24
+ :param exclude_files: 黑名单-文件全名 >>> ['.gitignore', 'README.md']
25
+ :param exclude_exts: 黑名单-文件后缀(包括.) >>> ['.csv', '.npy', '.pt', '.pth']
26
+ :param while_list: 白名单-文件全名 >>> ['.gitignore', 'README.md']
27
+ :param contain_empty_folder: 是否包含空文件夹
26
28
  :return:
27
29
  '''
28
30
  output_path = source_path + '.zip' if output_path is None else output_path
@@ -3,7 +3,7 @@ from pathlib import Path
3
3
  import subprocess
4
4
  import time
5
5
 
6
- from ..Bbasic import B_Color
6
+ from ..Butils import B_Color
7
7
 
8
8
 
9
9
  def args_process(args: tuple) -> list:
@@ -0,0 +1,6 @@
1
+
2
+ from .my_tqdm import B_Tqdm, B_Color, B_Appearance, B_Background
3
+
4
+ __all__ = [ 'B_Color', 'B_Appearance', 'B_Background',
5
+ 'B_Tqdm'
6
+ ]
@@ -2,7 +2,7 @@ import sys
2
2
  import time
3
3
  import threading
4
4
 
5
- from ..Bbasic import B_Color
5
+ from ..Butils import B_Color, B_Appearance, B_Background
6
6
 
7
7
 
8
8
  class B_Tqdm:
@@ -39,8 +39,14 @@ class B_Tqdm:
39
39
  seconds = int(seconds % 60)
40
40
  return f'{minutes:02}:{seconds:02}'
41
41
 
42
- def update(self, step=1, color=B_Color.BLUE, prefix=None, suffix=None):
42
+ def update(self, step=1, prefix=None, suffix=None, color:B_Color=B_Color.BLUE, appearance:B_Appearance=None, background:B_Background=None):
43
43
  with self._lock:
44
+ pre_show = color.value
45
+ if appearance is not None:
46
+ pre_show += appearance.value
47
+ if background is not None:
48
+ pre_show += background.value
49
+
44
50
  if self.current == 0:
45
51
  self.start_time = time.time()
46
52
  if prefix is not None:
@@ -66,12 +72,12 @@ class B_Tqdm:
66
72
  filled_length = int(self.length * self.current // self.total)
67
73
  bar = self.fill * filled_length + '-' * (self.length - filled_length) * len(self.fill)
68
74
 
69
- sys.stdout.write(f'\r{color}{self.prefix} |{bar}|'
75
+ sys.stdout.write(f'\r{pre_show}{self.prefix} |{bar}|'
70
76
  f' {self.current}/{self.total} -> {elapsed_str}<{estimated_str} | {speed:.1f} it/s |'
71
- f' {self.suffix}{B_Color.RESET}')
77
+ f' {self.suffix}{B_Color.RESET.value}')
72
78
  else:
73
- sys.stdout.write(f'\r{color}{self.prefix} | {self.current} iters -> {elapsed_str} | {speed:.1f} it/s |'
74
- f' {self.suffix}{B_Color.RESET}')
79
+ sys.stdout.write(f'\r{pre_show}{self.prefix} | {self.current} iters -> {elapsed_str} | {speed:.1f} it/s |'
80
+ f' {self.suffix}{B_Color.RESET.value}')
75
81
  sys.stdout.flush()
76
82
 
77
83
  # 补回车
@@ -0,0 +1,7 @@
1
+ from .text_style import B_Color, B_Appearance, B_Background
2
+ from .timer import B_Timer
3
+
4
+ __all__ = [
5
+ 'B_Color', 'B_Appearance', 'B_Background',
6
+ 'B_Timer'
7
+ ]
@@ -31,6 +31,7 @@ class B_Appearance(Enum):
31
31
 
32
32
  HIGHLIGHT = "\033[1m" # 高亮
33
33
  LOWLIGHT = "\033[2m" # 低亮
34
+ ITALIC = "\033[3m" # 斜体
34
35
  UNDERLINE = "\033[4m" # 下划线
35
36
  REVERSE = "\033[7m" # 反显(白底黑字)
36
37
 
@@ -41,12 +42,13 @@ if __name__ == '__main__':
41
42
  print("\033[0m默认文字\033[0m")
42
43
  print("\033[1m高亮文字\033[0m")
43
44
  print("\033[2m低亮文字\033[0m")
44
- # print("\033[3m无效文字\033[0m")
45
+ print("\033[3m斜体文字\033[0m") # 在某些终端中可能无效
45
46
  print("\033[4m下划线文字\033[0m")
46
- print("\033[5m闪烁文字(无效)\033[0m")
47
- # print("\033[6m无效文字\033[0m")
47
+ print("\033[5m闪烁文字\033[0m") # 在某些终端中可能无效
48
+ print("\033[6m快速闪烁文字\033[0m") # 在某些终端中可能无效
48
49
  print("\033[7m反显文字\033[0m")
49
50
  print("\033[8m消隐文字(无效)\033[0m")
51
+ # exit()
50
52
 
51
53
  print("\n\033[31;1m字体颜色\033[0m测试文字")
52
54
  print("\033[30m低亮黑色文字\033[0m\t\033[30;1m高亮黑色文字\033[0m")
@@ -0,0 +1,17 @@
1
+ import time
2
+ class B_Timer:
3
+ def __init__(self):
4
+ self.start_time = 0
5
+ self.end_time = 0
6
+
7
+ def __enter__(self):
8
+ self.start_time = time.time()
9
+ return self
10
+
11
+ def __exit__(self, exc_type, exc_val, exc_tb):
12
+ self.end_time = time.time()
13
+ print(f"[Timer] cost: {self.end_time - self.start_time:.4f}s")
14
+
15
+ if __name__ == '__main__':
16
+ with B_Timer():
17
+ time.sleep(2)
@@ -3,7 +3,7 @@ from typing import Literal
3
3
  import time
4
4
  import os
5
5
 
6
- from ..Bbasic import B_Color
6
+ from ..Butils import B_Color
7
7
 
8
8
  def color_wrap(string:str, color:B_Color):
9
9
  return color.value + string + B_Color.RESET.value
@@ -2,4 +2,4 @@
2
2
  # class 以"B_"开头
3
3
  # function 以"b_"开头
4
4
 
5
- __version__ = '0.0.2.12'
5
+ __version__ = '0.0.2.14'
@@ -1,4 +1,4 @@
1
- from ...Bbasic import B_Color
1
+ from ...Butils import B_Color
2
2
 
3
3
 
4
4
  class B_Config:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh_core
3
- Version: 0.0.2.12
3
+ Version: 0.0.2.14
4
4
  Summary: byzh_core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -10,14 +10,15 @@ byzh_core.egg-info/requires.txt
10
10
  byzh_core.egg-info/top_level.txt
11
11
  byzh_core/Barchive/__init__.py
12
12
  byzh_core/Barchive/archive.py
13
- byzh_core/Bbasic/__init__.py
14
- byzh_core/Bbasic/text_style.py
15
13
  byzh_core/Btable/__init__.py
16
14
  byzh_core/Btable/auto_table.py
17
15
  byzh_core/Bterminal/__init__.py
18
16
  byzh_core/Bterminal/cmd.py
19
17
  byzh_core/Btqdm/__init__.py
20
18
  byzh_core/Btqdm/my_tqdm.py
19
+ byzh_core/Butils/__init__.py
20
+ byzh_core/Butils/text_style.py
21
+ byzh_core/Butils/timer.py
21
22
  byzh_core/Bwriter/__init__.py
22
23
  byzh_core/Bwriter/writer.py
23
24
  byzh_core/obsolete/__init__.py
@@ -1,3 +0,0 @@
1
- from .text_style import B_Color, B_Appearance, B_Background
2
-
3
- __all__ = ['B_Color', 'B_Appearance', 'B_Background']
@@ -1,4 +0,0 @@
1
-
2
- from .my_tqdm import B_Tqdm
3
-
4
- __all__ = ['B_Tqdm']
File without changes
File without changes
File without changes
File without changes