diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 96c27cb..3003aa2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: autoupdate_commit_msg: ':arrow_up: auto update by pre-commit hooks' repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.14 + rev: v0.15.0 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/nonebot_plugin_tetris_stats/utils/templates.py b/nonebot_plugin_tetris_stats/utils/templates.py index 8d5e4cc..b14bb6e 100644 --- a/nonebot_plugin_tetris_stats/utils/templates.py +++ b/nonebot_plugin_tetris_stats/utils/templates.py @@ -71,7 +71,9 @@ def unzip_templates(zip_path: Path) -> Path: async def check_hash(hash_file_path: Path) -> bool: logger.info('开始校验模板哈希值') - for i in hash_file_path.read_text().splitlines(): + async with aopen(hash_file_path, encoding='utf-8') as f: + hash_content = await f.read() + for i in hash_content.splitlines(): file_sha256, file_relative_path = i.split(maxsplit=1) file_path = hash_file_path.parent / file_relative_path hasher = sha256()