byzh-core 0.0.2.10__tar.gz → 0.0.2.12__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.10 → byzh_core-0.0.2.12}/PKG-INFO +1 -1
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Barchive/archive.py +15 -11
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Bwriter/writer.py +7 -4
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/__init__.py +1 -1
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core.egg-info/PKG-INFO +1 -1
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core.egg-info/SOURCES.txt +0 -3
- byzh_core-0.0.2.10/byzh_core/Bmath/__init__.py +0 -4
- byzh_core-0.0.2.10/byzh_core/Bmath/divides.py +0 -41
- byzh_core-0.0.2.10/byzh_core/Bmath/get_norm.py +0 -21
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/LICENSE +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/README.md +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/B_os.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Barchive/__init__.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Bbasic/__init__.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Bbasic/text_style.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Btable/__init__.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Btable/auto_table.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Bterminal/__init__.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Bterminal/cmd.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Btqdm/__init__.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Btqdm/my_tqdm.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/Bwriter/__init__.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/obsolete/Bconfig/__init__.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/obsolete/Bconfig/config.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/obsolete/__init__.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/obsolete/auto_table.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/obsolete/row_table.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core/obsolete/xy_table.py +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core.egg-info/dependency_links.txt +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core.egg-info/requires.txt +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/byzh_core.egg-info/top_level.txt +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/setup.cfg +0 -0
- {byzh_core-0.0.2.10 → byzh_core-0.0.2.12}/setup.py +0 -0
@@ -1,10 +1,12 @@
|
|
1
1
|
import os
|
2
2
|
import zipfile
|
3
|
+
from pathlib import Path
|
4
|
+
|
3
5
|
from ..Btqdm import B_Tqdm
|
4
6
|
|
5
7
|
def b_archive_zip(
|
6
8
|
source_path,
|
7
|
-
output_path,
|
9
|
+
output_path:str|Path=None,
|
8
10
|
exclude_dirs:list[str]=None,
|
9
11
|
exclude_files:list[str]=None,
|
10
12
|
exclude_exts:list[str]=None,
|
@@ -13,21 +15,24 @@ def b_archive_zip(
|
|
13
15
|
):
|
14
16
|
'''
|
15
17
|
压缩文件夹,排除 指定文件夹and指定后缀文件
|
18
|
+
|
19
|
+
name代表前缀, ext代表后缀(包括.)
|
20
|
+
|
16
21
|
:param source_path:
|
17
|
-
:param output_path:
|
22
|
+
:param output_path: 如果不传入, 则默认为source_path同名同路径的zip文件
|
18
23
|
:param exclude_dirs: ['__pycache__', '.git', '.idea']
|
19
24
|
:param exclude_files: ['.gitignore', 'README.md']
|
20
25
|
:param exclude_exts: ['.csv', '.npy', '.pt', '.pth']
|
21
26
|
:return:
|
22
27
|
'''
|
23
|
-
if
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
output_path = source_path + '.zip' if output_path is None else output_path
|
29
|
+
def get_lst(lst):
|
30
|
+
return [] if lst is None else lst
|
31
|
+
exclude_dirs = get_lst(exclude_dirs)
|
32
|
+
exclude_files = get_lst(exclude_files)
|
33
|
+
exclude_exts = get_lst(exclude_exts)
|
34
|
+
while_list = get_lst(while_list)
|
35
|
+
|
31
36
|
|
32
37
|
my_tqdm = B_Tqdm(prefix='Archive')
|
33
38
|
|
@@ -49,7 +54,6 @@ def b_archive_zip(
|
|
49
54
|
# 排除指定后缀文件files
|
50
55
|
files = [f for f in files if f in while_list or not any(f.endswith(ext) for ext in exclude_exts)]
|
51
56
|
|
52
|
-
|
53
57
|
# 压缩文件:
|
54
58
|
for file in files:
|
55
59
|
file_path = os.path.join(root, file)
|
@@ -5,6 +5,9 @@ import os
|
|
5
5
|
|
6
6
|
from ..Bbasic import B_Color
|
7
7
|
|
8
|
+
def color_wrap(string:str, color:B_Color):
|
9
|
+
return color.value + string + B_Color.RESET.value
|
10
|
+
|
8
11
|
class B_Writer:
|
9
12
|
def __init__(
|
10
13
|
self,
|
@@ -22,7 +25,7 @@ class B_Writer:
|
|
22
25
|
self.mode = mode
|
23
26
|
self.time_file = time_file
|
24
27
|
|
25
|
-
self.color = color
|
28
|
+
self.color = color
|
26
29
|
|
27
30
|
self.f = None
|
28
31
|
self.setFile(self.path, self.mode, self.time_file)
|
@@ -66,9 +69,9 @@ class B_Writer:
|
|
66
69
|
t = time.strftime("%Y-%m-%d %H:%M:%S ##### ", time.localtime())
|
67
70
|
|
68
71
|
if color is None:
|
69
|
-
print(
|
72
|
+
print(color_wrap(t+str(string), self.color))
|
70
73
|
else:
|
71
|
-
print(
|
74
|
+
print(color_wrap(t+str(string), color))
|
72
75
|
|
73
76
|
def toFile(self, string:str, ifTime:bool=None):
|
74
77
|
'''
|
@@ -82,7 +85,7 @@ class B_Writer:
|
|
82
85
|
elif ifTime==True or self.time_file==True:
|
83
86
|
t = time.strftime("%Y-%m-%d %H:%M:%S ##### ", time.localtime())
|
84
87
|
|
85
|
-
self.f.write(str(string
|
88
|
+
self.f.write(str(t+string))
|
86
89
|
self.f.write("\n")
|
87
90
|
self.f.flush()
|
88
91
|
|
@@ -12,9 +12,6 @@ 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/Bmath/__init__.py
|
16
|
-
byzh_core/Bmath/divides.py
|
17
|
-
byzh_core/Bmath/get_norm.py
|
18
15
|
byzh_core/Btable/__init__.py
|
19
16
|
byzh_core/Btable/auto_table.py
|
20
17
|
byzh_core/Bterminal/__init__.py
|
@@ -1,41 +0,0 @@
|
|
1
|
-
from typing import Union, List, Set, Tuple
|
2
|
-
|
3
|
-
my_type1 = Union[int, float, str]
|
4
|
-
def get_num(num: my_type1):
|
5
|
-
if isinstance(num, str):
|
6
|
-
return float(num)
|
7
|
-
return num
|
8
|
-
|
9
|
-
my_type2 = Union[my_type1, List[my_type1], Set[my_type1], Tuple[my_type1]]
|
10
|
-
def b_divides(iterUp: my_type2, iterDown: my_type2):
|
11
|
-
"""
|
12
|
-
支持list, tuple, set, 单个数\n
|
13
|
-
iterUp as 分子\n
|
14
|
-
iterDown as 分母
|
15
|
-
"""
|
16
|
-
up = 1
|
17
|
-
down = 1
|
18
|
-
|
19
|
-
if not isinstance(iterUp, list) and not isinstance(iterUp, tuple) and not isinstance(iterUp, set):
|
20
|
-
up *= get_num(iterUp)
|
21
|
-
else:
|
22
|
-
for x in iterUp:
|
23
|
-
up *= get_num(x)
|
24
|
-
|
25
|
-
if not isinstance(iterDown, list) and not isinstance(iterDown, tuple) and not isinstance(iterDown, set):
|
26
|
-
down *= get_num(iterDown)
|
27
|
-
else:
|
28
|
-
for x in iterDown:
|
29
|
-
down *= get_num(x)
|
30
|
-
|
31
|
-
return up / down
|
32
|
-
|
33
|
-
if __name__ == '__main__':
|
34
|
-
result = b_divides([1, 2, 3], [4, 5])
|
35
|
-
print(result)
|
36
|
-
|
37
|
-
result = b_divides(6.63e-34, (9.11e-31, 3e8))
|
38
|
-
print(result)
|
39
|
-
|
40
|
-
result = b_divides('6.63e-34', ['9.11e-31', 3e8])
|
41
|
-
print(result)
|
@@ -1,21 +0,0 @@
|
|
1
|
-
from typing import Literal
|
2
|
-
def b_get_norm(
|
3
|
-
lst: list,
|
4
|
-
mode: Literal['min-max'] = 'min-max',
|
5
|
-
ndigits: int | None = None
|
6
|
-
) -> tuple[list, float, float]:
|
7
|
-
|
8
|
-
if mode =='min-max':
|
9
|
-
minimum = min(lst)
|
10
|
-
maximum = max(lst)
|
11
|
-
if ndigits is None:
|
12
|
-
result = [(x-minimum)/(maximum-minimum) for x in lst]
|
13
|
-
else:
|
14
|
-
result = [round((x-minimum)/(maximum-minimum), ndigits) for x in lst]
|
15
|
-
return (result, minimum, maximum)
|
16
|
-
|
17
|
-
|
18
|
-
if __name__ == '__main__':
|
19
|
-
lst = [1, 2, 3, 4, 5]
|
20
|
-
result = b_get_norm(lst)
|
21
|
-
print(result)
|
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
|