Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🎈 auto fixes by pre-commit hooks
  • Loading branch information
pre-commit-ci[bot] committed Apr 2, 2026
commit 722512f2d8768edeb0622da1c3b1d69d0dca22b0
2 changes: 1 addition & 1 deletion astrbot/core/pipeline/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def initialize(self, ctx: PipelineContext) -> None:
async def process(
self,
event: AstrMessageEvent,
) -> None | AsyncGenerator[None, None]:
) -> None | AsyncGenerator[None]:
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

collections.abc.AsyncGenerator expects two type parameters (yield type, send type). Using AsyncGenerator[None] is not a valid generic specialization for type checkers and is inconsistent with other Stage implementations in this repo (which use AsyncGenerator[None, None]). Consider changing this back to None | AsyncGenerator[None, None] (or switching to AsyncIterator[None] if you don’t need .asend() typing) and keep the docstring’s return type in sync.

Suggested change
) -> None | AsyncGenerator[None]:
) -> None | AsyncGenerator[None, None]:

Copilot uses AI. Check for mistakes.
Comment thread
FlanChanXwO marked this conversation as resolved.
"""处理事件

Args:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from astrbot import logger
from astrbot.api.event import MessageChain
from astrbot.api.message_components import At,File, Image, Plain, Record, Video
from astrbot.api.message_components import At, File, Image, Plain, Record, Video
from astrbot.api.platform import (
AstrBotMessage,
MessageMember,
Expand Down
1 change: 0 additions & 1 deletion astrbot/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

3 changes: 2 additions & 1 deletion tests/fixtures/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import shutil
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Callable
from typing import Any
from collections.abc import Callable
from unittest.mock import AsyncMock, MagicMock

from astrbot.core.message.components import BaseMessageComponent
Expand Down
2 changes: 1 addition & 1 deletion tests/test_local_filesystem_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_local_file_system_component_prefers_utf8_before_windows_locale(

skill_path = tmp_path / "skills" / "demo.txt"
skill_path.parent.mkdir(parents=True, exist_ok=True)
skill_path.write_bytes("技能内容".encode("utf-8"))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (testing): Using .encode() without an explicit encoding makes this test dependent on the environment’s default encoding and weakens its intent.

Given the test name (...prefers_utf8_before_windows_locale), using encode("utf-8") made the file content unambiguously UTF‑8 and aligned with the test’s intent. With plain .encode(), the bytes now vary with the system locale (e.g., cp1252/cp936 on Windows), so the test may behave differently across environments.

To keep the test deterministic and accurately exercise LocalFileSystemComponent’s UTF‑8 preference, please restore encode("utf-8") (or pass an explicit UTF‑8 encoding via the API you use).

skill_path.write_bytes("技能内容".encode())
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is specifically about UTF-8 vs Windows locale fallbacks; using .encode() makes the intended encoding implicit. Consider keeping .encode('utf-8') here to make the test’s setup unambiguous.

Suggested change
skill_path.write_bytes("技能内容".encode())
skill_path.write_bytes("技能内容".encode("utf-8"))

Copilot uses AI. Check for mistakes.

result = asyncio.run(LocalFileSystemComponent().read_file(str(skill_path)))

Expand Down
Loading