byzh-core 0.0.2.6__py3-none-any.whl → 0.0.2.8__py3-none-any.whl

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.
byzh_core/B_os.py CHANGED
@@ -58,29 +58,35 @@ def rm(path):
58
58
  if os.path.isfile(path):
59
59
  os.remove(path)
60
60
 
61
- def get_dirpaths_in_dir(root_dir_path, unwanted_dirname=['__pycache__']):
61
+
62
+ def get_dirpaths_in_dir(root_dir_path, exclude_dir=['__pycache__', '.git']):
62
63
  result = []
63
64
  for root, dirs, files in os.walk(root_dir_path):
65
+ for i, dir in enumerate(dirs):
66
+ if str(dir) in exclude_dir:
67
+ dirs.pop(i)
64
68
  path = Path(root)
65
- if path.name in unwanted_dirname:
66
- continue
67
69
  result.append(path)
68
70
 
69
71
  result = result[1:]
70
72
 
71
73
  return result
72
74
 
73
- def get_filepaths_in_dir(root_dir_path, unwanted_name=[], unwanted_suffix=['.pyc']):
75
+ def get_filepaths_in_dir(root_dir_path, exclude_name=[], exclude_suffix=['.pyc'], exclude_dir=['.git']):
74
76
  file_paths = []
75
77
  for root, dirs, files in os.walk(root_dir_path):
78
+ for i, dir in enumerate(dirs):
79
+ if str(dir) in exclude_dir:
80
+ dirs.pop(i)
76
81
  for file in files:
77
82
  file_path = os.path.join(root, file)
78
83
  file_path = Path(file_path)
79
- if file_path.name in unwanted_name or file_path.suffix in unwanted_suffix:
84
+ if file_path.name in exclude_name or file_path.suffix in exclude_suffix:
80
85
  continue
81
86
  file_paths.append(file_path)
82
87
  return file_paths
83
88
 
84
89
  if __name__ == '__main__':
85
- print(get_dirpaths_in_dir(r'E:\byzh_workingplace\byzh-rc-to-pypi\uploadToPypi_core\byzh_core'))
86
- print(get_filepaths_in_dir(r'E:\byzh_workingplace\byzh-rc-to-pypi\uploadToPypi_core\byzh_core'))
90
+ # print(get_dirpaths_in_dir(r'E:\byzh_workingplace\byzh-rc-to-pypi'))
91
+ a = get_filepaths_in_dir(r'E:\byzh_workingplace\byzh-rc-to-pypi')
92
+ print(a)
@@ -1,5 +1,6 @@
1
1
  import os
2
2
  import zipfile
3
+ from ..Btqdm import B_Tqdm
3
4
 
4
5
  def b_archive_zip(
5
6
  source_path,
@@ -28,11 +29,14 @@ def b_archive_zip(
28
29
  if while_list is None:
29
30
  while_list = []
30
31
 
32
+ my_tqdm = B_Tqdm(prefix='Archive')
33
+
31
34
  with zipfile.ZipFile(output_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
32
35
  # 压缩文件:
33
36
  if os.path.isfile(source_path):
34
37
  arcname = os.path.basename(source_path)
35
38
  zipf.write(source_path, arcname)
39
+ my_tqdm.update(1)
36
40
  return
37
41
 
38
42
  # 压缩文件夹:
@@ -52,15 +56,18 @@ def b_archive_zip(
52
56
  arcname = os.path.relpath(file_path, source_path) # 相对于source_path的相对路径
53
57
  zipf.write(file_path, arcname)
54
58
 
59
+ my_tqdm.update(1)
60
+
55
61
  # 若是空文件夹,则压缩文件夹:
56
62
  if contain_empty_folder and (len(dirs) == 0 and len(files) == 0):
57
63
  arcname = os.path.relpath(root, source_path)
58
64
  folder_path = root
59
65
  zipf.write(folder_path, arcname)
66
+ my_tqdm.update(1)
60
67
 
61
68
  if __name__ == '__main__':
62
69
  b_archive_zip(
63
- source_path=r'E:\byzh_workingplace\byzh-rc-to-pypi\awa',
70
+ source_path=r'E:\byzh_workingplace\byzh-rc-to-pypi\mnist',
64
71
  output_path=r'E:\byzh_workingplace\byzh-rc-to-pypi\awaqwq.zip',
65
72
  exclude_dirs=['__pycache__', 'com'],
66
73
  exclude_exts=['.ppt']
@@ -1,5 +1,3 @@
1
-
2
1
  from .writer import B_Writer
3
- from .globalwriter import B_GlobalWriter
4
2
 
5
- __all__ = ['B_Writer', 'B_GlobalWriter']
3
+ __all__ = ['B_Writer']
@@ -83,7 +83,7 @@ class B_Writer:
83
83
  assert color in COLOR_DICT, f"color参数错误,请输入{COLOR_DICT.keys()}"
84
84
  print(COLOR_DICT.get(color) + str(string) + B_Color.RESET)
85
85
 
86
- def toFile(self, string, ifTime=None):
86
+ def toFile(self, string, ifTime:bool=None):
87
87
  '''
88
88
  写入到文件内
89
89
  '''
@@ -99,7 +99,7 @@ class B_Writer:
99
99
  self.f.write("\n")
100
100
  self.f.flush()
101
101
 
102
- def toBoth(self, string, ifTime=False, color: Color_Literal = None):
102
+ def toBoth(self, string, ifTime:bool=None, color: Color_Literal = None):
103
103
  '''
104
104
  同时写入到文件和terminal
105
105
  :param string:
@@ -116,7 +116,7 @@ class B_Writer:
116
116
  self.toWant_cmd = toCmd
117
117
  self.toWant_file = toFile
118
118
 
119
- def toWant(self, string, ifTime=False, color: Color_Literal = None):
119
+ def toWant(self, string, ifTime:bool=None, color: Color_Literal = None):
120
120
  '''
121
121
  使用前先调用setWant方法
122
122
  '''
byzh_core/__init__.py CHANGED
@@ -2,4 +2,4 @@
2
2
  # class 以"B_"开头
3
3
  # function 以"b_"开头
4
4
 
5
- __version__ = '0.0.2.6'
5
+ __version__ = '0.0.2.8'
@@ -1,4 +1,4 @@
1
- from ..Bbasic import B_Color
1
+ from ...Bbasic 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.6
3
+ Version: 0.0.2.8
4
4
  Summary: byzh_core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -0,0 +1,28 @@
1
+ byzh_core/B_os.py,sha256=-6KjK2NzEeF8GiQno0BmbVDei9DDxOaXdaKGqFeL_eY,2372
2
+ byzh_core/__init__.py,sha256=6NxQhYgkeNinqxuU-8uI_EgJ3bPHRGvETr4ceXTsZ6E,110
3
+ byzh_core/Barchive/__init__.py,sha256=wUdz646VS0Uhq9lwMkd3YQHCvQhLDqgADoDjFGMqIn0,65
4
+ byzh_core/Barchive/archive.py,sha256=6uMoOs-lmdcezdOgXr4s9NmjHVRDvG4v_YGQhaPPyGo,2681
5
+ byzh_core/Bbasic/__init__.py,sha256=wr7Y7YJINhgpV5X6BT5DaGJKcHUOZYNerCGXoi2Egac,116
6
+ byzh_core/Bbasic/text_style.py,sha256=JelgL3AgcH607Mr-Bvr4u8Svb0twmNmqwXvOl4hHOSs,3161
7
+ byzh_core/Bmath/__init__.py,sha256=G3AQug6izkEX3UfzO_mqUNJW88ZKlmYb4Q8CAactK4w,105
8
+ byzh_core/Bmath/divides.py,sha256=dr85IqGSE9NvugQu7az29GLcjRiLjXU_hZTwtNifIXg,1132
9
+ byzh_core/Bmath/get_norm.py,sha256=y1QsCTo7qhtGTXIxpc6JtamLWloC7ENRuVdNtK5yi58,596
10
+ byzh_core/Btable/__init__.py,sha256=NlQBjp_mvObEUm4y6wXbGipkNM2N3uNIUidaJkTwFsw,62
11
+ byzh_core/Btable/auto_table.py,sha256=nc8RvF86laDnITAzX8sVj3l5tbIGflrsstIbSbGDaAI,14747
12
+ byzh_core/Bterminal/__init__.py,sha256=B6p6mHVhi5LAHKlvqfrv20E6XNqUsfU2xD753V6-Zf4,83
13
+ byzh_core/Bterminal/cmd.py,sha256=iK0fwI0D3peEwUYYZWwnl9X8ImFfrBsEq6ySd3DcRdE,3839
14
+ byzh_core/Btqdm/__init__.py,sha256=PQRcUn9WXd1YGyFMEKnJU74mdV695_8NHQ56Nsja0DM,53
15
+ byzh_core/Btqdm/my_tqdm.py,sha256=myyFo3GgyX_wWfSjMWfSTkcnTECf1tqwpXEFpJkzNtw,2878
16
+ byzh_core/Bwriter/__init__.py,sha256=7db9No0yYOW5ZUtFVKWLRZcu_nz3kvw2W25IoiIiilE,54
17
+ byzh_core/Bwriter/writer.py,sha256=7WlQUva_yu8zt0IuvWCJufdpFSkEC33UTxsyJGEaLRo,4019
18
+ byzh_core/obsolete/__init__.py,sha256=wpfHMPD4awPRDJVYlaiGtkkpjq2srWB7d7LrWhoX5R0,161
19
+ byzh_core/obsolete/auto_table.py,sha256=nC9eHj_IIGVkS2lmN_1gtOyglLCaGlwdoHzPvNNQDEw,13952
20
+ byzh_core/obsolete/row_table.py,sha256=rIX0-Yvb3RnO0RJBkA4m18gux1zYSnEKTy6uQGcWilc,5999
21
+ byzh_core/obsolete/xy_table.py,sha256=-KHK8EUlkJj3Rh0sp_KHI0QFt29AlMASMmR8q8ykUBM,6784
22
+ byzh_core/obsolete/Bconfig/__init__.py,sha256=7lAp7wNetW0AyJcike7ekdY_8wrQQtFjBsi6684t_lU,54
23
+ byzh_core/obsolete/Bconfig/config.py,sha256=TD8CC1P2Zu95Tf8AGK2IHRXjrCCMBA_tdoZsc1Rr0Gk,10953
24
+ byzh_core-0.0.2.8.dist-info/LICENSE,sha256=-nRwf0Xga4AX5bsWBXXflpDpgX_U23X06oAMcdf0dSY,1089
25
+ byzh_core-0.0.2.8.dist-info/METADATA,sha256=spMNZXXqa9GLz-_TgftAMH9NLrbEZ7cxYIPxsO-MeaM,371
26
+ byzh_core-0.0.2.8.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
27
+ byzh_core-0.0.2.8.dist-info/top_level.txt,sha256=Xv-pzvl6kPdIbi5UehQcUdGhLtb8-4WhS5dRK1LINwM,10
28
+ byzh_core-0.0.2.8.dist-info/RECORD,,
byzh_core/Bos/B_os.py DELETED
@@ -1,35 +0,0 @@
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)
byzh_core/Bos/__init__.py DELETED
@@ -1,4 +0,0 @@
1
- from .remove import b_rm
2
- from .make import b_makedir
3
-
4
- __all__ = ['b_rm', 'b_makedir']
byzh_core/Bos/make.py DELETED
@@ -1,38 +0,0 @@
1
- from pathlib import Path
2
- import os
3
- import shutil
4
-
5
- def is_dir(path):
6
- path = Path(path)
7
-
8
- # 存在
9
- if os.path.isdir(path):
10
- return True
11
-
12
- # 不存在
13
- name = path.name
14
- if '.' in name:
15
- return False
16
- return True
17
-
18
- def is_file(path):
19
- path = Path(path)
20
-
21
- # 存在
22
- if os.path.isfile(path):
23
- return True
24
-
25
- # 不存在
26
- name = path.name
27
- if '.' in name:
28
- return True
29
- return False
30
- def b_makedir(path):
31
- path = Path(path)
32
-
33
- if is_dir(path):
34
- os.makedirs(path, exist_ok=True)
35
- if is_file(path):
36
- os.makedirs(path.parent, exist_ok=True)
37
-
38
-
byzh_core/Bos/remove.py DELETED
@@ -1,8 +0,0 @@
1
- import os
2
- import shutil
3
-
4
- def b_rm(path):
5
- if os.path.isdir(path):
6
- shutil.rmtree(path)
7
- if os.path.isfile(path):
8
- os.remove(path)
@@ -1,62 +0,0 @@
1
- import threading
2
- import time
3
- import atexit
4
-
5
-
6
- class B_GlobalWriter():
7
- _instance = None
8
- _lock = threading.Lock()
9
-
10
- def __new__(cls):
11
- if cls._instance is None:
12
- with cls._lock:
13
- if cls._instance is None:
14
- cls._instance = super().__new__(cls)
15
- # 初始化
16
- cls._instance.file = None
17
- cls._instance.f = None
18
- cls._instance.ifTime = False
19
- atexit.register(cls._instance.closeFile) # 注册关闭方法
20
- return cls._instance
21
-
22
- @classmethod
23
- def setFile(cls, file, ifTime=False):
24
- cls()
25
- cls._instance.ifTime = ifTime
26
- cls._instance.path = file
27
- cls._instance.f = open(cls._instance.path, "a", encoding="utf-8")
28
-
29
- @classmethod
30
- def clearFile(cls):
31
- cls()
32
- assert cls._instance.f is not None, "请先调用setFile方法"
33
- cls._instance.f.close()
34
- cls._instance.f = open(cls._instance.path, 'w', encoding="utf-8")
35
-
36
- @classmethod
37
- def closeFile(cls):
38
- if cls._instance.f:
39
- cls._instance.f.close()
40
- cls._instance.f = None
41
-
42
- @classmethod
43
- def toCmd(cls, string):
44
- cls()
45
- print(string)
46
-
47
- @classmethod
48
- def toFile(cls, string):
49
- cls()
50
- assert cls._instance.f is not None, "请先调用setFile方法"
51
- if cls._instance.ifTime:
52
- t = time.strftime("%Y-%m-%d %H:%M:%S ##### ", time.localtime())
53
- cls._instance.f.write(t)
54
- cls._instance.f.write(string)
55
- cls._instance.f.write("\n")
56
- cls._instance.f.flush()
57
-
58
- @classmethod
59
- def toBoth(cls, string):
60
- cls()
61
- cls.toFile(string)
62
- cls.toCmd(string)
@@ -1,33 +0,0 @@
1
- byzh_core/B_os.py,sha256=VFhqVrhcCSm3_gQ0NULqmygYSgO2sOqSIYIYNjQQ2QY,2237
2
- byzh_core/__init__.py,sha256=Nr5HYfsPfCNuPTXhAwoSPvWfb6ePd7BqOucEE1qKOBU,110
3
- byzh_core/Barchive/__init__.py,sha256=wUdz646VS0Uhq9lwMkd3YQHCvQhLDqgADoDjFGMqIn0,65
4
- byzh_core/Barchive/archive.py,sha256=yIQgef1APUcZdHM_7Pa9rCam-P3PA3pbcSJSaySoUj4,2498
5
- byzh_core/Bbasic/__init__.py,sha256=wr7Y7YJINhgpV5X6BT5DaGJKcHUOZYNerCGXoi2Egac,116
6
- byzh_core/Bbasic/text_style.py,sha256=JelgL3AgcH607Mr-Bvr4u8Svb0twmNmqwXvOl4hHOSs,3161
7
- byzh_core/Bconfig/__init__.py,sha256=7lAp7wNetW0AyJcike7ekdY_8wrQQtFjBsi6684t_lU,54
8
- byzh_core/Bconfig/config.py,sha256=zfURiqwxXrPo4Pei63GaVvTslHnYTgmleCjeaGBR9K8,10952
9
- byzh_core/Bmath/__init__.py,sha256=G3AQug6izkEX3UfzO_mqUNJW88ZKlmYb4Q8CAactK4w,105
10
- byzh_core/Bmath/divides.py,sha256=dr85IqGSE9NvugQu7az29GLcjRiLjXU_hZTwtNifIXg,1132
11
- byzh_core/Bmath/get_norm.py,sha256=y1QsCTo7qhtGTXIxpc6JtamLWloC7ENRuVdNtK5yi58,596
12
- byzh_core/Bos/B_os.py,sha256=iGzL9if9Jh5z3U_qWRPIZCrHly2ZCz8MJLWiJwYVefA,763
13
- byzh_core/Bos/__init__.py,sha256=mMa6OugZs8gIfZMj7go_wEHZRe0JRffgiyIKTF5I_uc,88
14
- byzh_core/Bos/make.py,sha256=uGmHc96lXChihJs2jGiXJRp3tU_U5DPCo8jcc-aW6d4,663
15
- byzh_core/Bos/remove.py,sha256=HuGQlEOz7IZB_c6T9MzR3miRx60IeaBYP-3lp-P20-I,156
16
- byzh_core/Btable/__init__.py,sha256=NlQBjp_mvObEUm4y6wXbGipkNM2N3uNIUidaJkTwFsw,62
17
- byzh_core/Btable/auto_table.py,sha256=nc8RvF86laDnITAzX8sVj3l5tbIGflrsstIbSbGDaAI,14747
18
- byzh_core/Btable/obsolete/__init__.py,sha256=wpfHMPD4awPRDJVYlaiGtkkpjq2srWB7d7LrWhoX5R0,161
19
- byzh_core/Btable/obsolete/auto_table.py,sha256=nC9eHj_IIGVkS2lmN_1gtOyglLCaGlwdoHzPvNNQDEw,13952
20
- byzh_core/Btable/obsolete/row_table.py,sha256=rIX0-Yvb3RnO0RJBkA4m18gux1zYSnEKTy6uQGcWilc,5999
21
- byzh_core/Btable/obsolete/xy_table.py,sha256=-KHK8EUlkJj3Rh0sp_KHI0QFt29AlMASMmR8q8ykUBM,6784
22
- byzh_core/Bterminal/__init__.py,sha256=B6p6mHVhi5LAHKlvqfrv20E6XNqUsfU2xD753V6-Zf4,83
23
- byzh_core/Bterminal/cmd.py,sha256=iK0fwI0D3peEwUYYZWwnl9X8ImFfrBsEq6ySd3DcRdE,3839
24
- byzh_core/Btqdm/__init__.py,sha256=PQRcUn9WXd1YGyFMEKnJU74mdV695_8NHQ56Nsja0DM,53
25
- byzh_core/Btqdm/my_tqdm.py,sha256=myyFo3GgyX_wWfSjMWfSTkcnTECf1tqwpXEFpJkzNtw,2878
26
- byzh_core/Bwriter/__init__.py,sha256=KSsbCJZ-1j5wOr-ZbTg8K3A8Du73d22DQVLdmq-3CBo,116
27
- byzh_core/Bwriter/globalwriter.py,sha256=tSjWxzLylAeZep67n5jbRsjQkXkBKRZLvKXUyGSY92Q,1824
28
- byzh_core/Bwriter/writer.py,sha256=px0ZNoSuXS_RbwVnYsBx2lYohyhHACfHM8-HBNEflhU,4006
29
- byzh_core-0.0.2.6.dist-info/LICENSE,sha256=-nRwf0Xga4AX5bsWBXXflpDpgX_U23X06oAMcdf0dSY,1089
30
- byzh_core-0.0.2.6.dist-info/METADATA,sha256=ira6o6p4YHEW2I2AhxwV0snAJlYbkrVa44hacgpkGmA,371
31
- byzh_core-0.0.2.6.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
32
- byzh_core-0.0.2.6.dist-info/top_level.txt,sha256=Xv-pzvl6kPdIbi5UehQcUdGhLtb8-4WhS5dRK1LINwM,10
33
- byzh_core-0.0.2.6.dist-info/RECORD,,
File without changes
File without changes
File without changes
File without changes
File without changes