fix: remove unused imports and bare exception aliases (pyflakes F401/F841)

Remove unused imports across 86 files in src/, web_interface/, test/,
and scripts/ using autoflake. No logic changes — only dead import
statements and unused names in from-imports are removed.

Also remove bare exception aliases where the variable is never
referenced in the handler body:
- src/cache/disk_cache.py: except (IOError, OSError, PermissionError) as e
- src/cache_manager.py: except (OSError, IOError, PermissionError) as perm_error
- src/plugin_system/resource_monitor.py: except Exception as e
- web_interface/app.py: except Exception as read_err

86 files changed, 205 lines removed, 18 pre-existing test failures unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Chuck
2026-05-14 10:41:55 -04:00
parent b090705b4c
commit 55161f309b
86 changed files with 63 additions and 205 deletions

View File

@@ -6,10 +6,9 @@ Tests Flask routes, request/response handling, and API functionality.
import pytest
import json
import os
import sys
from pathlib import Path
from unittest.mock import MagicMock, patch, Mock
from unittest.mock import MagicMock, patch
# Add project root to path
project_root = Path(__file__).parent.parent
@@ -288,7 +287,6 @@ class TestDisplayAPI:
@patch('web_interface.blueprints.api_v3._ensure_cache_manager')
def test_stop_on_demand_display(self, mock_ensure_cache, client):
"""Test stopping on-demand display."""
from web_interface.blueprints.api_v3 import api_v3
# Mock the cache manager returned by _ensure_cache_manager
mock_cache_manager = MagicMock()
@@ -440,7 +438,6 @@ class TestPluginsAPI:
def test_get_plugin_schema(self, client):
"""Test getting plugin configuration schema."""
from web_interface.blueprints.api_v3 import api_v3
response = client.get('/api/v3/plugins/schema?plugin_id=weather')
@@ -477,7 +474,6 @@ class TestPluginsAPI:
def test_get_operation_history(self, client):
"""Test getting operation history."""
from web_interface.blueprints.api_v3 import api_v3
response = client.get('/api/v3/plugins/operation/history')
@@ -487,7 +483,6 @@ class TestPluginsAPI:
def test_get_plugin_state(self, client):
"""Test getting plugin state."""
from web_interface.blueprints.api_v3 import api_v3
response = client.get('/api/v3/plugins/state')