byzh-core 0.0.2.1__tar.gz → 0.0.2.3__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 (40) hide show
  1. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/PKG-INFO +1 -1
  2. byzh_core-0.0.2.3/byzh_core/B_os.py +60 -0
  3. byzh_core-0.0.2.3/byzh_core/Bos/B_os.py +35 -0
  4. byzh_core-0.0.2.3/byzh_core/Bos/__init__.py +4 -0
  5. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bos/make.py +12 -0
  6. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Btable/auto_table.py +5 -5
  7. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Btqdm/my_tqdm.py +2 -2
  8. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/__init__.py +1 -1
  9. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core.egg-info/PKG-INFO +1 -1
  10. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core.egg-info/SOURCES.txt +2 -1
  11. byzh_core-0.0.2.1/byzh_core/Bos/__init__.py +0 -6
  12. byzh_core-0.0.2.1/byzh_core/Bos/path.py +0 -17
  13. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/LICENSE +0 -0
  14. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/README.md +0 -0
  15. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Barchive/__init__.py +0 -0
  16. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Barchive/archive.py +0 -0
  17. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bbasic/__init__.py +0 -0
  18. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bbasic/text_style.py +0 -0
  19. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bconfig/__init__.py +0 -0
  20. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bconfig/config.py +0 -0
  21. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bmath/__init__.py +0 -0
  22. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bmath/divides.py +0 -0
  23. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bmath/get_norm.py +0 -0
  24. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bos/remove.py +0 -0
  25. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Btable/__init__.py +0 -0
  26. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Btable/obsolete/__init__.py +0 -0
  27. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Btable/obsolete/b_auto_table.py +0 -0
  28. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Btable/row_table.py +0 -0
  29. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Btable/xy_table.py +0 -0
  30. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bterminal/__init__.py +0 -0
  31. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bterminal/cmd.py +0 -0
  32. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Btqdm/__init__.py +0 -0
  33. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bwriter/__init__.py +0 -0
  34. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bwriter/globalwriter.py +0 -0
  35. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core/Bwriter/writer.py +0 -0
  36. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core.egg-info/dependency_links.txt +0 -0
  37. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core.egg-info/requires.txt +0 -0
  38. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/byzh_core.egg-info/top_level.txt +0 -0
  39. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/setup.cfg +0 -0
  40. {byzh_core-0.0.2.1 → byzh_core-0.0.2.3}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh_core
3
- Version: 0.0.2.1
3
+ Version: 0.0.2.3
4
4
  Summary: byzh_core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -0,0 +1,60 @@
1
+ import shutil
2
+ import os
3
+ from pathlib import Path
4
+ from typing import Literal
5
+
6
+ def get_parent_dir(path: Literal['__file__']) -> Path:
7
+ '''
8
+ 获取 该py文件 所在的文件夹
9
+ :param path: __file__
10
+ '''
11
+ parent_dir = Path(path).parent
12
+ return parent_dir
13
+
14
+ def get_cwd() -> Path:
15
+ '''
16
+ 获取 当前工作目录current working directory
17
+ '''
18
+ return Path.cwd()
19
+
20
+
21
+ def makedirs(path):
22
+ def is_dir(path):
23
+ path = Path(path)
24
+
25
+ # 存在
26
+ if os.path.isdir(path):
27
+ return True
28
+
29
+ # 不存在
30
+ name = path.name
31
+ if '.' in name:
32
+ return False
33
+ return True
34
+
35
+ def is_file(path):
36
+ path = Path(path)
37
+
38
+ # 存在
39
+ if os.path.isfile(path):
40
+ return True
41
+
42
+ # 不存在
43
+ name = path.name
44
+ if '.' in name:
45
+ return True
46
+ return False
47
+
48
+ path = Path(path)
49
+
50
+ if is_dir(path):
51
+ os.makedirs(path, exist_ok=True)
52
+ if is_file(path):
53
+ os.makedirs(path.parent, exist_ok=True)
54
+
55
+ def rm(path):
56
+ if os.path.isdir(path):
57
+ shutil.rmtree(path)
58
+ if os.path.isfile(path):
59
+ os.remove(path)
60
+
@@ -0,0 +1,35 @@
1
+ import shutil
2
+ import os
3
+ from pathlib import Path
4
+ from typing import Literal
5
+
6
+ def get_parent_dir(path: Literal['__file__']) -> Path:
7
+ '''
8
+ 获取 该py文件 所在的文件夹
9
+ :param path: __file__
10
+ '''
11
+ parent_dir = Path(path).parent
12
+ return parent_dir
13
+
14
+ def get_cwd() -> Path:
15
+ '''
16
+ 获取 当前工作目录current working directory
17
+ '''
18
+ return Path.cwd()
19
+
20
+
21
+ def makedirs(path):
22
+ from .make import is_dir, is_file
23
+
24
+ path = Path(path)
25
+
26
+ if is_dir(path):
27
+ os.makedirs(path, exist_ok=True)
28
+ if is_file(path):
29
+ os.makedirs(path.parent, exist_ok=True)
30
+
31
+ def rm(path):
32
+ if os.path.isdir(path):
33
+ shutil.rmtree(path)
34
+ if os.path.isfile(path):
35
+ os.remove(path)
@@ -0,0 +1,4 @@
1
+ from .remove import b_rm
2
+ from .make import b_makedir
3
+
4
+ __all__ = ['b_rm', 'b_makedir']
@@ -4,6 +4,12 @@ import shutil
4
4
 
5
5
  def is_dir(path):
6
6
  path = Path(path)
7
+
8
+ # 存在
9
+ if os.path.isdir(path):
10
+ return True
11
+
12
+ # 不存在
7
13
  name = path.name
8
14
  if '.' in name:
9
15
  return False
@@ -11,6 +17,12 @@ def is_dir(path):
11
17
 
12
18
  def is_file(path):
13
19
  path = Path(path)
20
+
21
+ # 存在
22
+ if os.path.isfile(path):
23
+ return True
24
+
25
+ # 不存在
14
26
  name = path.name
15
27
  if '.' in name:
16
28
  return True
@@ -172,7 +172,7 @@ class B_AutoTable:
172
172
  dir = Path(path).resolve().parent
173
173
  os.makedirs(dir, exist_ok=True)
174
174
  with open(path, 'w') as f:
175
- f.write(self.get_table_by_str())
175
+ f.write(self.to_str())
176
176
 
177
177
  def update_txt(self, path):
178
178
  '''
@@ -194,7 +194,7 @@ class B_AutoTable:
194
194
 
195
195
 
196
196
 
197
- def get_table_by_strs(self) -> List[str]:
197
+ def to_strs(self) -> List[str]:
198
198
  transpose = self._need_transpose()
199
199
  self._update_all(transpose)
200
200
  self._update_widths()
@@ -222,9 +222,9 @@ class B_AutoTable:
222
222
 
223
223
  return results
224
224
 
225
- def get_table_by_str(self) -> str:
225
+ def to_str(self) -> str:
226
226
  result = ""
227
- strs = self.get_table_by_strs()
227
+ strs = self.to_strs()
228
228
  for x in strs[:-1]:
229
229
  result += x + '\n'
230
230
  result += strs[-1]
@@ -391,7 +391,7 @@ class B_AutoTable:
391
391
  return True
392
392
  return False
393
393
  def __str__(self):
394
- return self.get_table_by_str()
394
+ return self.to_str()
395
395
 
396
396
  def __getitem__(self, index):
397
397
  index = str(index)
@@ -19,7 +19,7 @@ class B_Tqdm:
19
19
  :param total: 总数
20
20
  :param prefix: 前缀
21
21
  :param suffix: 后缀
22
- :param length: 进度条长度(字符)
22
+ :param length: 进度条长度(字符), 默认为20个字符长度
23
23
  :param fill: 填充字符
24
24
  """
25
25
  super().__init__()
@@ -64,7 +64,7 @@ class B_Tqdm:
64
64
  # 更新进度条
65
65
  if self.total is not None:
66
66
  filled_length = int(self.length * self.current // self.total)
67
- bar = self.fill * filled_length + '-' * (self.length - filled_length)
67
+ bar = self.fill * filled_length + '-' * (self.length - filled_length) * len(self.fill)
68
68
 
69
69
  sys.stdout.write(f'\r{color}{self.prefix} |{bar}|'
70
70
  f' {self.current}/{self.total} -> {elapsed_str}<{estimated_str} | {speed:.1f} it/s |'
@@ -2,4 +2,4 @@
2
2
  # class 以"B_"开头
3
3
  # function 以"b_"开头
4
4
 
5
- __version__ = '0.0.2.1'
5
+ __version__ = '0.0.2.3'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh_core
3
- Version: 0.0.2.1
3
+ Version: 0.0.2.3
4
4
  Summary: byzh_core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -1,6 +1,7 @@
1
1
  LICENSE
2
2
  README.md
3
3
  setup.py
4
+ byzh_core/B_os.py
4
5
  byzh_core/__init__.py
5
6
  byzh_core.egg-info/PKG-INFO
6
7
  byzh_core.egg-info/SOURCES.txt
@@ -16,9 +17,9 @@ byzh_core/Bconfig/config.py
16
17
  byzh_core/Bmath/__init__.py
17
18
  byzh_core/Bmath/divides.py
18
19
  byzh_core/Bmath/get_norm.py
20
+ byzh_core/Bos/B_os.py
19
21
  byzh_core/Bos/__init__.py
20
22
  byzh_core/Bos/make.py
21
- byzh_core/Bos/path.py
22
23
  byzh_core/Bos/remove.py
23
24
  byzh_core/Btable/__init__.py
24
25
  byzh_core/Btable/auto_table.py
@@ -1,6 +0,0 @@
1
- from .remove import b_rm
2
- from .make import b_makedir
3
- from .path import b_get_parent_dir, b_get_cwd
4
-
5
-
6
- __all__ = ['b_rm', 'b_makedir', 'b_get_parent_dir', 'b_get_cwd']
@@ -1,17 +0,0 @@
1
- import os
2
- from pathlib import Path
3
- from typing import Literal
4
-
5
- def b_get_parent_dir(path: Literal['__file__']) -> Path:
6
- '''
7
- 获取 该py文件 所在的文件夹
8
- :param path: __file__
9
- '''
10
- parent_dir = Path(path).parent
11
- return parent_dir
12
-
13
- def b_get_cwd() -> Path:
14
- '''
15
- 获取 当前工作目录current working directory
16
- '''
17
- return Path.cwd()
File without changes
File without changes
File without changes
File without changes