From f26aca38a477fc8bbab2553ffe234154c74c856c Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sat, 17 Oct 2026 07:19:38 +0800 Subject: [PATCH] fix(types): expose stdio stream encoding --- app/adapters/system/stdio.py | 7 ++----- mypy.ini | 1 + tests/fixtures/architecture/mypy-baseline.json | 3 --- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/adapters/system/stdio.py b/app/adapters/system/stdio.py index 1d8879493..8f52d9c6c 100644 --- a/app/adapters/system/stdio.py +++ b/app/adapters/system/stdio.py @@ -16,6 +16,8 @@ class RotatingLineStream(io.TextIOBase): 同时保证启动阶段的 print/uvicorn 输出也能按配置滚动。 """ + encoding = "utf-8" + def __init__(self, log_file: Path, max_bytes: int, backup_count: int): """创建写入指定滚动日志文件的文本流。""" super().__init__() @@ -37,11 +39,6 @@ class RotatingLineStream(io.TextIOBase): handler.setFormatter(logging.Formatter("%(message)s")) self._logger.addHandler(handler) - @property - def encoding(self) -> str: - """返回日志流使用的文本编码。""" - return "utf-8" - def writable(self) -> bool: """声明该文本流支持写入。""" return True diff --git a/mypy.ini b/mypy.ini index 5103b1fe0..68829a65d 100644 --- a/mypy.ini +++ b/mypy.ini @@ -7,6 +7,7 @@ follow_imports = skip show_error_codes = True pretty = True files = + app/adapters/system/stdio.py, app/adapters/web/plugin/routes.py, app/api/endpoints/workflow.py, app/adapters/external/cookiecloud.py, diff --git a/tests/fixtures/architecture/mypy-baseline.json b/tests/fixtures/architecture/mypy-baseline.json index 4fbe7ea4b..bd14fe298 100644 --- a/tests/fixtures/architecture/mypy-baseline.json +++ b/tests/fixtures/architecture/mypy-baseline.json @@ -75,9 +75,6 @@ "no-untyped-def": 1, "type-arg": 19 }, - "app/adapters/system/stdio.py": { - "override": 1 - }, "app/agent/llm/capability.py": { "no-any-return": 4, "no-untyped-def": 6,