diff --git a/pyproject.toml b/pyproject.toml index 7a68475..773773a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,9 @@ packages = ["src/easy_tdx"] [tool.mypy] strict = true -python_version = "3.10" +python_version = "3.12" +# 跳过未跟踪的本地脚本(依赖外部 unified_config/sqlalchemy/requests,不属于库) +exclude = ["src/easy_tdx/exchange_margin\\.py"] [[tool.mypy.overrides]] module = ["pandas", "tabulate", "matplotlib", "matplotlib.*"] @@ -44,7 +46,7 @@ ignore_missing_imports = true [tool.ruff] target-version = "py310" line-length = 100 -extend-exclude = ["*.pyi"] +extend-exclude = ["*.pyi", "src/easy_tdx/exchange_margin.py"] [tool.ruff.lint] select = ["E", "F", "I", "UP"] diff --git a/src/easy_tdx/web/routers/market.py b/src/easy_tdx/web/routers/market.py index 1ce495d..ef16663 100644 --- a/src/easy_tdx/web/routers/market.py +++ b/src/easy_tdx/web/routers/market.py @@ -145,9 +145,7 @@ async def market_strength( # 注:在协程内用 get_running_loop() 而非 get_event_loop(), # 后者在 Python 3.12+ 已弃用。 loop = asyncio.get_running_loop() - results = await loop.run_in_executor( - None, lambda: ranker.rank(universe=universe, top_n=top_n) - ) + results = await loop.run_in_executor(None, lambda: ranker.rank(universe=universe, top_n=top_n)) records = [ { diff --git a/tests/unit/test_screen.py b/tests/unit/test_screen.py index c3ef703..5292466 100644 --- a/tests/unit/test_screen.py +++ b/tests/unit/test_screen.py @@ -681,9 +681,7 @@ class TestStrengthRankerInit: from easy_tdx.screen.strength import StrengthRanker with patch("easy_tdx.screen.strength.resolve_vipdoc", return_value=Path("/fake")): - ranker = StrengthRanker( - preset="steady", w5=0.5, w20=0.3, w60=0.2, vol_adjusted=False - ) + ranker = StrengthRanker(preset="steady", w5=0.5, w20=0.3, w60=0.2, vol_adjusted=False) assert ranker._w5 == 0.5 assert ranker._w20 == 0.3 assert ranker._w60 == 0.2 @@ -695,4 +693,3 @@ class TestStrengthRankerInit: with patch("easy_tdx.screen.strength.resolve_vipdoc", return_value=Path("/fake")): ranker = StrengthRanker(preset="breakout") assert ranker.preset == "breakout" -