Skip to content

Commit 64a91e6

Browse files
committed
style: keep strict with dynamic boundary ignores
1 parent 7067c29 commit 64a91e6

15 files changed

Lines changed: 45 additions & 32 deletions

File tree

aao/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import argparse
1919
import os
2020
import sys
21-
from typing import TYPE_CHECKING
21+
from typing import TYPE_CHECKING, Any
2222

2323
if TYPE_CHECKING:
2424
from maa.controller import Win32Controller
@@ -493,7 +493,7 @@ def _reset_measure_timer(self, node_name: str) -> None:
493493
logger.debug("计时器重置(pipeline 节点: %s)", node_name)
494494
self.worker.request_reset_timer()
495495

496-
def _on_measure_state(self, state: dict) -> None:
496+
def _on_measure_state(self, state: dict[str, Any]) -> None:
497497
from aao.core.timing.time_source import format_timer
498498

499499
total = state.get("totalElapsedFrames", 0)

aao/core/avatar.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import json
1212
import time
1313
from pathlib import Path
14-
from typing import TYPE_CHECKING
14+
from typing import TYPE_CHECKING, Any
1515

1616
import numpy as np
1717

@@ -71,7 +71,7 @@ def _normalize_name(name: str) -> str:
7171
def detect_slots(
7272
context: Context,
7373
image: np.ndarray,
74-
) -> list[dict]:
74+
) -> list[dict[str, Any]]:
7575
"""用 pipeline 节点 DetectSlots 检测待部署区所有干员槽位。"""
7676
reco_detail = context.run_recognition("DetectSlots", image)
7777

@@ -217,7 +217,7 @@ def _ocr_oper_name(context: Context, detail_img: np.ndarray) -> str | None:
217217

218218
def _save_avatar_from_image(
219219
image: np.ndarray,
220-
slot: dict,
220+
slot: dict[str, Any],
221221
oper_name: str,
222222
) -> bool:
223223
"""从截图截取槽位头像并存盘。"""

aao/core/geometry/map_loader.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import json
1212
from pathlib import Path
13+
from typing import Any
1314

1415
from aao.utils.logger import logger
1516
from aao.utils.runtime_paths import project_root
@@ -52,7 +53,7 @@ def find_map_file(code: str) -> Path | None:
5253
return None
5354

5455

55-
def load_map(code: str) -> dict | None:
56+
def load_map(code: str) -> dict[str, Any] | None:
5657
"""加载关卡数据。code 如 '1-7'。"""
5758
path = find_map_file(code)
5859
if path is None:

aao/core/geometry/view.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from __future__ import annotations
1111

1212
import math
13+
from typing import Any
1314

1415
import numpy as np
1516

@@ -69,7 +70,7 @@ def _build_matrix(view_offset: list[float], side: bool) -> np.ndarray:
6970

7071

7172
def transform_map_to_view(
72-
level_data: dict,
73+
level_data: dict[str, Any],
7374
side: bool = False,
7475
) -> list[list[tuple[float, float]]]:
7576
"""把关卡数据投影为屏幕坐标(0-1 比例)。

aao/core/timing/battle_state.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from dataclasses import dataclass
1515
from enum import Enum
16+
from typing import Any
1617

1718
import numpy as np
1819

@@ -445,7 +446,9 @@ def detect_battle_state(frame: np.ndarray) -> BattleState:
445446
}
446447

447448

448-
def _diagnose_battle_begin_bands(frame: np.ndarray, width: int, height: int, scale: float) -> dict:
449+
def _diagnose_battle_begin_bands(
450+
frame: np.ndarray, width: int, height: int, scale: float
451+
) -> dict[str, Any]:
449452
"""诊断 7 band sampling 各 band 的值。"""
450453
step = max(4, round(scale * BATTLE_BEGIN_SAMPLE_STEP_SCALE))
451454
top_y_step = max(step, round(height * 0.10))

aao/measure/api_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ApiServer:
2525

2626
def __init__(
2727
self,
28-
get_state: Callable[[], dict],
28+
get_state: Callable[[], dict[str, Any]],
2929
host: str = "localhost",
3030
port: int = DEFAULT_PORT,
3131
rate_hz: float = 60.0,
@@ -34,7 +34,7 @@ def __init__(
3434
self.host = host
3535
self.port = port
3636
self.rate_hz = rate_hz
37-
self._clients: set = set()
37+
self._clients: set[Any] = set()
3838
self._thread: threading.Thread | None = None
3939

4040
def start(self) -> None:

aao/measure/overlay.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
from __future__ import annotations
88

9+
from typing import Any
10+
911
from PySide6.QtCore import QRectF, Qt, QTimer
1012
from PySide6.QtGui import (
1113
QColor,
@@ -131,7 +133,7 @@ def reset_layout(self, x: int, y: int) -> None:
131133
self.move(x, y)
132134
self._save_window_state()
133135

134-
def on_state(self, state: dict) -> None:
136+
def on_state(self, state: dict[str, Any]) -> None:
135137
running = state.get("isRunning", False)
136138
cf = state.get("currentFrame")
137139
total = state.get("totalFramesInCycle", 0)

aao/measure/worker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import threading
1111
import time
12-
from typing import TYPE_CHECKING
12+
from typing import TYPE_CHECKING, Any
1313

1414
from PySide6.QtCore import QObject, Signal
1515

@@ -47,11 +47,11 @@ def __init__(
4747
self._running = False
4848
self._reset_requested = False
4949
self._consecutive_errors = 0
50-
self._latest: dict = {}
50+
self._latest: dict[str, Any] = {}
5151
self._lock = threading.Lock()
5252

5353
@property
54-
def latest_state(self) -> dict:
54+
def latest_state(self) -> dict[str, Any]:
5555
with self._lock:
5656
return dict(self._latest)
5757

aao/resources/updater.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from collections.abc import Callable
2626
from dataclasses import dataclass
2727
from pathlib import Path
28+
from typing import Any
2829

2930
from aao import __version__
3031
from aao.resources import syncer
@@ -209,13 +210,13 @@ def update_resources(
209210
progress_cb(r.message)
210211
return results
211212

212-
def update_all(self, progress_cb: Callable[[str], None] | None = None) -> dict:
213+
def update_all(self, progress_cb: Callable[[str], None] | None = None) -> dict[str, Any]:
213214
"""检查软件更新 + 更新资源。
214215
215216
Returns:
216217
{"software": ReleaseInfo | None, "resources": [SyncResult]}
217218
"""
218-
result: dict = {}
219+
result: dict[str, Any] = {}
219220

220221
if progress_cb:
221222
progress_cb("检查软件更新...")
@@ -417,7 +418,7 @@ def apply_update(self, zip_path: Path) -> None:
417418
_DOWNLOAD_BACKOFF_SEC = 1.0
418419

419420

420-
def _pick_win_asset(assets: list) -> AssetInfo | None:
421+
def _pick_win_asset(assets: list[dict[str, Any]]) -> AssetInfo | None:
421422
"""从 release assets 里选 win-x64 zip。"""
422423
for a in assets:
423424
name = str(a.get("name", "")).lower()

aao/ui/farm_worker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import json
1414
import threading
1515
import time
16-
from typing import TYPE_CHECKING
16+
from typing import TYPE_CHECKING, Any
1717

1818
from PySide6.QtCore import QObject, Signal
1919

@@ -114,7 +114,7 @@ def _on_node(node_name: str) -> None:
114114
tl_param = json.dumps({"timeline_path": self._timeline_path}, ensure_ascii=False)
115115
pipeline["Farm@ClickStage"]["custom_recognition_param"] = tl_param
116116

117-
exec_param: dict = {"timeline_path": self._timeline_path}
117+
exec_param: dict[str, Any] = {"timeline_path": self._timeline_path}
118118
if self._profile:
119119
exec_param["calibration"] = self._profile
120120
pipeline["Farm@Execute"]["custom_action_param"] = json.dumps(exec_param, ensure_ascii=False)

0 commit comments

Comments
 (0)