1
0

style: 代码格式化

This commit is contained in:
2025-12-13 21:47:37 +08:00
parent 02d2cc48aa
commit a3e34b6565
64 changed files with 755 additions and 573 deletions

View File

@@ -1,6 +1,7 @@
from heurams.context import config_var
import pathlib
def probe_by_filename(filename):
"""探测指定文件 (无扩展名) 的所有信息"""
paths: dict = config_var.get().get("paths")
@@ -8,17 +9,18 @@ def probe_by_filename(filename):
result = {}
for item, attr in paths.items():
for i in formats:
attr: pathlib.Path = pathlib.Path(attr) / filename + '.' + i
attr: pathlib.Path = pathlib.Path(attr) / filename + "." + i
if attr.exists():
result[item.replace("_dir", "")] = str(attr)
return result
def probe_all(is_stem = 1):
def probe_all(is_stem=1):
"""依据目录探测所有信息
Args:
is_stem (boolean): 是否**删除**文件扩展名
Returns:
dict: 有三项, 每一项的键名都是文件组类型, 值都是文件组列表, 只包含文件名
"""
@@ -35,7 +37,9 @@ def probe_all(is_stem = 1):
result[item.replace("_dir", "")].append(str(i.name))
return result
if __name__ == "__main__":
import os
print(os.getcwd())
print(probe_all())