Skip to content

Commit 11feefc

Browse files
committed
fix: resolve all ruff lint errors (import sorting, unused imports)
- ruff --fix: sorted imports across all modules, removed unused `time` import in engine.py and unused `conf` variable in runner.py - main_fast.py: added # noqa: E402 for intentional post-setup imports, replaced function-attribute guard with module-level _cleanup_called flag, added type: ignore[union-attr] for sys.stdout/stderr.detach() on win32 - main_gui.py: added type annotation for startup_animations list - mypy.ini: added with platform=win32 so Windows-only attrs resolve correctly (winreg, os.startfile, subprocess.CREATE_NEW_CONSOLE)
1 parent 4454eae commit 11feefc

22 files changed

Lines changed: 180 additions & 132 deletions

assistant/asr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
23
import gc
34
import logging
45
import os

assistant/core/state.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
23
import subprocess
34
from dataclasses import dataclass, field
45

assistant/nlu/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from .engine import nlu_rules, ALLOWED_INTENTS, load_config_cached
1+
from .engine import ALLOWED_INTENTS, load_config_cached, nlu_rules
22

33
__all__ = ["nlu_rules", "ALLOWED_INTENTS", "load_config_cached"]

assistant/nlu/engine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import annotations
2+
23
import json
34
import logging
45
import os
56
import re
6-
import time
77
from pathlib import Path
88
from typing import Any
99

assistant/nlu/normalizer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
2-
import re
2+
33
import logging
4+
import re
45

56
try:
67
import pymorphy2

assistant/nlu/ollama_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
23
import json
34
import logging
45
import os
@@ -7,7 +8,7 @@
78

89
import requests
910

10-
from .normalizer import _has_too_much_cjk, _extract_json
11+
from .normalizer import _extract_json, _has_too_much_cjk
1112

1213
logger = logging.getLogger(__name__)
1314

assistant/recorder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
from __future__ import annotations
2+
23
import logging
34
import time
45
from typing import Optional
56

7+
import keyboard
68
import numpy as np
79
import sounddevice as sd
810
import soundfile as sf
9-
import keyboard
1011

1112
from assistant.core.exceptions import AudioError
1213

assistant/runner.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from __future__ import annotations
2+
23
import logging
34
import re
45
import time
56
from typing import Optional
67

7-
from .skills import SKILLS
88
from .core.exceptions import SkillError
9+
from .skills import SKILLS
910

1011
logger = logging.getLogger(__name__)
1112

@@ -81,7 +82,7 @@ def run_command(cmd: dict) -> None:
8182
intent: str = cmd["intent"]
8283
args: dict = cmd.get("args", {})
8384
speak: Optional[str] = cmd.get("speak")
84-
conf: float = float(cmd.get("confidence", 1.0))
85+
float(cmd.get("confidence", 1.0))
8586

8687
now = time.time()
8788
command_key = f"{intent}:{args}"

assistant/skills/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
try:
2-
from .registry import SKILLS
32
from .app_control import APP_ALIASES
3+
from .registry import SKILLS
44
except ImportError:
55
SKILLS = {}
66
APP_ALIASES = {}

assistant/skills/app_control.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
23
import difflib
34
import glob
45
import json
@@ -275,8 +276,8 @@ def open_app(alias: str) -> None:
275276

276277
def minimize_app(alias: str) -> None:
277278
try:
278-
import win32gui
279279
import win32con
280+
import win32gui
280281
except ImportError as exc:
281282
raise SkillError("pywin32 не установлен") from exc
282283

0 commit comments

Comments
 (0)