fix: resolve all CI mypy (265→0) and ruff (26→0) errors

- pyproject.toml: add mypy overrides for pandas/tabulate/matplotlib stubs,
  disable strict checking for vendored MyTT library
- config.py: use cast() for dict[str, Any] .get() returns
- beichi.py: widen _calc_bi_force param to BI | XD, import XD
- backtest/cli.py: split combo/single strategy into separate typed variables
- backtest/combo.py: add bool_array() helper for numpy return types
- chanlun/analyser.py: type ignore for pandas row access, fix dict type arg
- unified.py: change fields param from object to Any
- ex/mac_client.py: add type args to list literals
- cli/cmd_offline.py: wrap int market as Market enum before API call
- cli/cmd_chanlun.py: fix dict type arg
- offline/write_*.py: explicit int() cast for struct.unpack returns
- MyTT.py: fix line-too-long comments, UP038 isinstance syntax
- tests: fix E712 (==False → ~mask), E741 (noqa), F841, import sorting
- ruff format applied across codebase

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
GitHub
2026-06-10 15:03:41 +08:00
co-authored by Claude Opus 4.8
parent 5aac7d3a39
commit 4dfd18050e
51 changed files with 548 additions and 335 deletions
+4 -7
View File
@@ -13,7 +13,7 @@ from easy_tdx.chanlun.types import CLKline, Kline
# ── helpers ──────────────────────────────────────────────────────────────
def _k(idx: int, dt: str, o: float, c: float, h: float, l: float, a: float = 0.0) -> Kline:
def _k(idx: int, dt: str, o: float, c: float, h: float, l: float, a: float = 0.0) -> Kline: # noqa: E741
return Kline(
index=idx,
date=datetime.strptime(dt, "%Y-%m-%d"),
@@ -55,9 +55,8 @@ class TestMultiLevel:
def test_multi_level_basic(self) -> None:
"""多级别分析应返回各级别结果。"""
from easy_tdx.chanlun.multi_level import MultiLevelAnalyser
from easy_tdx.chanlun.analyser import ChanlunAnalyser
from easy_tdx.chanlun.multi_level import MultiLevelAnalyser
df_daily = _make_df(100)
df_30min = _make_df(200)
@@ -77,9 +76,8 @@ class TestMultiLevel:
def test_multi_level_low_level_qs(self) -> None:
"""高级别笔对应的低级别趋势信息。"""
from easy_tdx.chanlun.multi_level import MultiLevelAnalyser
from easy_tdx.chanlun.analyser import ChanlunAnalyser
from easy_tdx.chanlun.multi_level import MultiLevelAnalyser
df_daily = _make_df(100)
df_30min = _make_df(200)
@@ -158,9 +156,8 @@ class TestZsd:
def test_zsd_from_xds(self) -> None:
"""线段应能组合为走势段。"""
from easy_tdx.chanlun.zsd import find_zsds
from easy_tdx.chanlun.xd import find_xds
from easy_tdx.chanlun.zsd import find_zsds
cks = [
CLKline(