Skip to content

Commit b8a8573

Browse files
authored
fix: circular import (#472)
* fix: circular import * Update map_controller.py
1 parent 406236c commit b8a8573

2 files changed

Lines changed: 3 additions & 12 deletions

File tree

autowsgr/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""AutoWSGR - 战舰少女R 自动化框架(v2)"""
22

3-
__version__ = '2.2.0'
3+
__version__ = '2.2.0.post1'

autowsgr/ui/decisive/map_controller.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from __future__ import annotations
1515

1616
import time
17-
from functools import lru_cache
1817
from typing import TYPE_CHECKING
1918

2019
import cv2
@@ -55,8 +54,6 @@
5554

5655

5756
if TYPE_CHECKING:
58-
from collections.abc import Callable
59-
6057
from autowsgr.context import GameContext
6158
from autowsgr.infra import DecisiveConfig
6259
from autowsgr.vision.api_dll import ApiDll
@@ -65,13 +62,6 @@
6562
_log = get_logger('ui.decisive')
6663

6764

68-
@lru_cache(maxsize=1)
69-
def _get_recognize_ship_drop() -> Callable:
70-
from autowsgr.combat import recognize_ship_drop as _fn
71-
72-
return _fn
73-
74-
7565
SKILL_USED = PixelSignature(
7666
name='skill_used',
7767
strategy=MatchStrategy.ALL,
@@ -590,6 +580,7 @@ def confirm_leave(self) -> None:
590580

591581
def confirm_stage_clear(self) -> list[str]: # noqa: PLR0912
592582
"""小关通关后确认弹窗并收集掉落舰船。"""
583+
from autowsgr.combat import recognize_ship_drop
593584
from autowsgr.image_resources import Templates
594585
from autowsgr.ui.utils import confirm_operation
595586

@@ -629,7 +620,7 @@ def confirm_stage_clear(self) -> list[str]: # noqa: PLR0912
629620
if detail is None:
630621
break
631622

632-
ship_drop = _get_recognize_ship_drop()(screen, ocr=self._ocr)
623+
ship_drop = recognize_ship_drop(screen, ocr=self._ocr)
633624
_log.info(f'[地图控制器] 检测到掉落: {ship_drop.ship_name}({ship_drop.ship_type})')
634625
collected.append(ship_drop.ship_name)
635626
self._ctrl.click(0.953, 0.954)

0 commit comments

Comments
 (0)