perf: 用 autoflake 删除无用依赖

没想到居然能意外地大幅提升启动速度
This commit is contained in:
2026-04-22 06:44:59 +08:00
parent 093034828b
commit b9d88383f9
38 changed files with 184 additions and 703 deletions

View File

@@ -200,7 +200,6 @@ class PrecachingScreen(Screen):
def precache_by_text(self, text: str):
"""预缓存单段文本的音频"""
from heurams.context import config_var, rootdir, workdir
cache_dir.mkdir(parents=True, exist_ok=True)
cache_file = cache_dir / f"{hasher.get_md5(text)}.wav"
@@ -259,7 +258,7 @@ class PrecachingScreen(Screen):
def precache_all_files(self):
"""预缓存所有文件"""
from heurams.context import config_var, rootdir, workdir
from heurams.context import config_var
from heurams.kernel.repolib import Repo
repo_path = pathlib.Path(config_var.get()["global"]["paths"]["data"]) / "repo"
@@ -315,7 +314,6 @@ class PrecachingScreen(Screen):
try:
import shutil
from heurams.context import config_var, rootdir, workdir
shutil.rmtree(cache_dir, ignore_errors=True)
self.update_status("已清空", "音频缓存已清空", 0)