Skip to content

Commit a2cd944

Browse files
committed
fix: add future annotations for Python 3.10 compatibility
Fixes Python 3.10 TypeError where logging.StreamHandler[TextIO] is not subscriptable at runtime. Also disables TC003 ruff rule that's overly pedantic when using __future__ annotations. This resolves test failures in CI for Python 3.10.
1 parent 9340438 commit a2cd944

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ ignore = [
124124
# "RUF002", # Docstring contains ambiguous -- allow specific ambiguous via lint.allowed-confusables
125125
# "RUF003", # Comment contains ambiguous -- allow specific ambiguous via lint.allowed-confusables
126126

127+
"TC003", # Move standard library import into TYPE_CHECKING block (too pedantic with __future__ annotations)
128+
127129
# "TRY300", # Consider moving this statement to an `else` block
128130
]
129131

src/pocket_build/utils_logs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# src/pocket_build/utils_logs.py
22
"""Shared Apathetic CLI logger implementation."""
33

4+
from __future__ import annotations
5+
46
import argparse
57
import builtins
68
import importlib
@@ -329,7 +331,7 @@ def use_level(self, level: str | int) -> Generator[None, None, None]:
329331

330332

331333
class TagFormatter(logging.Formatter):
332-
def format(self: "TagFormatter", record: logging.LogRecord) -> str:
334+
def format(self: TagFormatter, record: logging.LogRecord) -> str:
333335
tag_color, tag_text = TAG_STYLES.get(record.levelname, ("", ""))
334336
msg = super().format(record)
335337
if tag_text:

0 commit comments

Comments
 (0)