byzh-core 0.0.9.9__py3-none-any.whl → 0.0.9.11__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
@@ -151,7 +151,39 @@ def walk(
151
151
  new_path = os.path.join(root, dirname)
152
152
  yield from walk(new_path, black_dirnames, black_filenames, black_stems, black_exts)
153
153
 
154
+
155
+ def dir_tree(path: Path, show_root=True, verbose=True, prefix=""):
156
+ '''
157
+ 显示目录树
158
+ '''
159
+ path = Path(path)
160
+
161
+ result = ""
162
+ if show_root:
163
+ root_name = path.resolve().name
164
+ result += root_name + "\n"
165
+ prefix += "" # 根目录本身不需要额外缩进
166
+
167
+ entries = sorted(path.iterdir(), key=lambda x: (x.is_file(), x.name.lower()))
168
+ for i, entry in enumerate(entries):
169
+ connector = "└── " if i == len(entries) - 1 else "├── "
170
+ result += prefix + connector + entry.name + "\n"
171
+ if entry.is_dir():
172
+ extension = " " if i == len(entries) - 1 else "│ "
173
+ result += dir_tree(
174
+ entry,
175
+ show_root=False, # 子目录不显示自己
176
+ verbose=False, # 子目录不打印自己
177
+ prefix=prefix + extension,
178
+ )
179
+
180
+ if verbose:
181
+ print(result)
182
+
183
+ return result
184
+
185
+
154
186
  if __name__ == '__main__':
155
187
  # print(get_dirpaths_in_dir(r'E:\byzh_workingplace\byzh-rc-to-pypi'))
156
188
  a = get_filepaths_in_dir(r'/')
157
- print(a)
189
+ print(a)
@@ -2,6 +2,7 @@ import os
2
2
  from pathlib import Path
3
3
  import subprocess
4
4
  import time
5
+ import sys
5
6
 
6
7
  from ..Butils import B_Color
7
8
 
@@ -70,6 +71,7 @@ def b_run_python(
70
71
  for string in str_lst:
71
72
  try:
72
73
  command_lst = string.split(' ')
74
+ command_lst[0] = sys.executable # 将'python'替换为当前环境下的python
73
75
  run_log("正在执行: " + string)
74
76
  start = time.time()
75
77
  result = subprocess.run(command_lst, timeout=limit_time)
byzh/core/__main__.py CHANGED
@@ -6,4 +6,12 @@ def b_zip():
6
6
  args = parser.parse_args()
7
7
 
8
8
  from .Barchive import b_archive_zip
9
- b_archive_zip(args.dir_path)
9
+ b_archive_zip(args.dir_path)
10
+
11
+ def b_dirtree():
12
+ parser = argparse.ArgumentParser()
13
+ parser.add_argument("dir_path")
14
+ args = parser.parse_args()
15
+
16
+ from . import B_os
17
+ B_os.dir_tree(args.dir_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: byzh-core
3
- Version: 0.0.9.9
3
+ Version: 0.0.9.11
4
4
  Summary: byzh-core是byzh系列的核心库,包含了一些常用的工具函数和类。
5
5
  Author: byzh_rc
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
- byzh/core/B_os.py,sha256=06JGOEheFQqvSLNKtbeo9x5V9qx5cZ8OEjAXKy6PTeM,4278
1
+ byzh/core/B_os.py,sha256=Lu1tGAJd3oYaShbIcm6D1ozv13bFsKwXIEqos5IsakA,5252
2
2
  byzh/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- byzh/core/__main__.py,sha256=o7-Mn6j1g-VGWhE13goDOMmxKSlXvtrkYVkwt4DrCjo,217
3
+ byzh/core/__main__.py,sha256=01JiW5BjSeqW3WLGUZqMzimiTsrvcCE-3UEI1wCqrhI,408
4
4
  byzh/core/Barchive/__init__.py,sha256=wUdz646VS0Uhq9lwMkd3YQHCvQhLDqgADoDjFGMqIn0,65
5
5
  byzh/core/Barchive/archive.py,sha256=S1hy3qYFEZr5RRmx_Mnq1s2IMUEw973ny1rKSL7J_a0,6721
6
6
  byzh/core/Brecorder/__init__.py,sha256=rYlgYIhr_AcPuGkZRCitbi2_hZYyoERk4XIZ14CU1dk,108
@@ -9,7 +9,7 @@ byzh/core/Brecorder/record2d.py,sha256=lwyxV4xLzngvn_uU2mpDwqNrJzaVhosYzCOQ_QIKt
9
9
  byzh/core/Btable/__init__.py,sha256=NlQBjp_mvObEUm4y6wXbGipkNM2N3uNIUidaJkTwFsw,62
10
10
  byzh/core/Btable/auto_table.py,sha256=avMeRWydw9L8s3fU0-BSl8a2dCyreIUzW--csm5eR0g,14734
11
11
  byzh/core/Bterminal/__init__.py,sha256=azRLD-kY8Tv2c3llHRBrEJIdVgYw6hAoLgzJeA4PvE0,142
12
- byzh/core/Bterminal/cmd.py,sha256=qtT2ru1Bo3I9A_5hUXfve-aq0Jxi1jpHfcMgtmZqEHo,3925
12
+ byzh/core/Bterminal/cmd.py,sha256=ihO5r5qWvUO2_AHcnlr_F9MSFIUdltv8En1C6dbjV5Q,4029
13
13
  byzh/core/Bterminal/run_func.py,sha256=B2CZSxdSrcBbt7w5_hnOYrUmwrjK5CPqbyyt_YkB_I0,1836
14
14
  byzh/core/Btqdm/__init__.py,sha256=G8pvJYizvdTUI3Xw-yELXY7BbjTghCXJLdqUuDoRNZA,141
15
15
  byzh/core/Btqdm/my_tqdm.py,sha256=MMYFwy5dUCzg8fzRWZ7vrpZ-q_DDqoLvywDk8rgSaSM,3578
@@ -19,9 +19,9 @@ byzh/core/Butils/text_style.py,sha256=34u2-Rsur63iNQ0m7tHxpFWqnQZWybSxBx7vnhOhqD
19
19
  byzh/core/Butils/timer.py,sha256=OLxbWWRauYjp1KwavACjoyrqrCciUiIG2ae7qgtZrVA,511
20
20
  byzh/core/Bwriter/__init__.py,sha256=QcHzKs0305Pr78ZvZgcC_4miSYZh8jJQDt5TD0GIeEg,82
21
21
  byzh/core/Bwriter/writer.py,sha256=C45DOHz2-znA5KOimwAYf0V-Yn63Sym59eNyUHbmfzk,3216
22
- byzh_core-0.0.9.9.dist-info/LICENSE,sha256=-nRwf0Xga4AX5bsWBXXflpDpgX_U23X06oAMcdf0dSY,1089
23
- byzh_core-0.0.9.9.dist-info/METADATA,sha256=VsrKNOcAIB-zx1K0laUI6Lr7Ml0spybm5mGKS6jyB88,371
24
- byzh_core-0.0.9.9.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
25
- byzh_core-0.0.9.9.dist-info/entry_points.txt,sha256=TaXq5DKEgdQ_0ctDU8_PKEhj2HoCmZawoxSrVuwOWBM,51
26
- byzh_core-0.0.9.9.dist-info/top_level.txt,sha256=tmaFVY8uApe6apOETSOgwz-4v5Mj4uxgRT8yNnDNZNA,5
27
- byzh_core-0.0.9.9.dist-info/RECORD,,
22
+ byzh_core-0.0.9.11.dist-info/LICENSE,sha256=-nRwf0Xga4AX5bsWBXXflpDpgX_U23X06oAMcdf0dSY,1089
23
+ byzh_core-0.0.9.11.dist-info/METADATA,sha256=MBtmDQiLRkSiRBrHie8LtigKNFK8sMYrrt7S4HACSaM,372
24
+ byzh_core-0.0.9.11.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
25
+ byzh_core-0.0.9.11.dist-info/entry_points.txt,sha256=_9Faf_-R44wbi7oNQ9I9LvB8rxDIvg_s5V1olZ3JpZI,92
26
+ byzh_core-0.0.9.11.dist-info/top_level.txt,sha256=tmaFVY8uApe6apOETSOgwz-4v5Mj4uxgRT8yNnDNZNA,5
27
+ byzh_core-0.0.9.11.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  [console_scripts]
2
+ b_dirtree = byzh.core.__main__:b_dirtree
2
3
  b_zip = byzh.core.__main__:b_zip