byzh-core 0.0.2.6__tar.gz → 0.0.2.8__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.
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/PKG-INFO +1 -1
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/B_os.py +13 -7
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Barchive/archive.py +8 -1
- byzh_core-0.0.2.8/byzh_core/Bwriter/__init__.py +3 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Bwriter/writer.py +3 -3
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/__init__.py +1 -1
- {byzh_core-0.0.2.6/byzh_core → byzh_core-0.0.2.8/byzh_core/obsolete}/Bconfig/config.py +1 -1
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core.egg-info/PKG-INFO +1 -1
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core.egg-info/SOURCES.txt +7 -12
- byzh_core-0.0.2.6/byzh_core/Bos/B_os.py +0 -35
- byzh_core-0.0.2.6/byzh_core/Bos/__init__.py +0 -4
- byzh_core-0.0.2.6/byzh_core/Bos/make.py +0 -38
- byzh_core-0.0.2.6/byzh_core/Bos/remove.py +0 -8
- byzh_core-0.0.2.6/byzh_core/Bwriter/__init__.py +0 -5
- byzh_core-0.0.2.6/byzh_core/Bwriter/globalwriter.py +0 -62
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/LICENSE +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/README.md +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Barchive/__init__.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Bbasic/__init__.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Bbasic/text_style.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Bmath/__init__.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Bmath/divides.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Bmath/get_norm.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Btable/__init__.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Btable/auto_table.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Bterminal/__init__.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Bterminal/cmd.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Btqdm/__init__.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core/Btqdm/my_tqdm.py +0 -0
- {byzh_core-0.0.2.6/byzh_core → byzh_core-0.0.2.8/byzh_core/obsolete}/Bconfig/__init__.py +0 -0
- {byzh_core-0.0.2.6/byzh_core/Btable → byzh_core-0.0.2.8/byzh_core}/obsolete/__init__.py +0 -0
- {byzh_core-0.0.2.6/byzh_core/Btable → byzh_core-0.0.2.8/byzh_core}/obsolete/auto_table.py +0 -0
- {byzh_core-0.0.2.6/byzh_core/Btable → byzh_core-0.0.2.8/byzh_core}/obsolete/row_table.py +0 -0
- {byzh_core-0.0.2.6/byzh_core/Btable → byzh_core-0.0.2.8/byzh_core}/obsolete/xy_table.py +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core.egg-info/dependency_links.txt +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core.egg-info/requires.txt +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/byzh_core.egg-info/top_level.txt +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/setup.cfg +0 -0
- {byzh_core-0.0.2.6 → byzh_core-0.0.2.8}/setup.py +0 -0
@@ -58,29 +58,35 @@ def rm(path):
|
|
58
58
|
if os.path.isfile(path):
|
59
59
|
os.remove(path)
|
60
60
|
|
61
|
-
|
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,
|
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
|
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
|
86
|
-
|
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\
|
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']
|
@@ -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=
|
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=
|
119
|
+
def toWant(self, string, ifTime:bool=None, color: Color_Literal = None):
|
120
120
|
'''
|
121
121
|
使用前先调用setWant方法
|
122
122
|
'''
|
@@ -12,25 +12,20 @@ byzh_core/Barchive/__init__.py
|
|
12
12
|
byzh_core/Barchive/archive.py
|
13
13
|
byzh_core/Bbasic/__init__.py
|
14
14
|
byzh_core/Bbasic/text_style.py
|
15
|
-
byzh_core/Bconfig/__init__.py
|
16
|
-
byzh_core/Bconfig/config.py
|
17
15
|
byzh_core/Bmath/__init__.py
|
18
16
|
byzh_core/Bmath/divides.py
|
19
17
|
byzh_core/Bmath/get_norm.py
|
20
|
-
byzh_core/Bos/B_os.py
|
21
|
-
byzh_core/Bos/__init__.py
|
22
|
-
byzh_core/Bos/make.py
|
23
|
-
byzh_core/Bos/remove.py
|
24
18
|
byzh_core/Btable/__init__.py
|
25
19
|
byzh_core/Btable/auto_table.py
|
26
|
-
byzh_core/Btable/obsolete/__init__.py
|
27
|
-
byzh_core/Btable/obsolete/auto_table.py
|
28
|
-
byzh_core/Btable/obsolete/row_table.py
|
29
|
-
byzh_core/Btable/obsolete/xy_table.py
|
30
20
|
byzh_core/Bterminal/__init__.py
|
31
21
|
byzh_core/Bterminal/cmd.py
|
32
22
|
byzh_core/Btqdm/__init__.py
|
33
23
|
byzh_core/Btqdm/my_tqdm.py
|
34
24
|
byzh_core/Bwriter/__init__.py
|
35
|
-
byzh_core/Bwriter/
|
36
|
-
byzh_core/
|
25
|
+
byzh_core/Bwriter/writer.py
|
26
|
+
byzh_core/obsolete/__init__.py
|
27
|
+
byzh_core/obsolete/auto_table.py
|
28
|
+
byzh_core/obsolete/row_table.py
|
29
|
+
byzh_core/obsolete/xy_table.py
|
30
|
+
byzh_core/obsolete/Bconfig/__init__.py
|
31
|
+
byzh_core/obsolete/Bconfig/config.py
|
@@ -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)
|
@@ -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
|
-
|
@@ -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)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|