mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-05-15 10:03:31 +00:00
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:
@@ -1,4 +1,4 @@
|
||||
from flask import Flask, Blueprint, render_template, request, redirect, url_for, flash, jsonify, Response, send_from_directory
|
||||
from flask import Flask, request, redirect, url_for, jsonify, Response, send_from_directory
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
@@ -21,7 +21,6 @@ from src.plugin_system.operation_queue import PluginOperationQueue
|
||||
from src.plugin_system.state_manager import PluginStateManager
|
||||
from src.plugin_system.operation_history import OperationHistory
|
||||
from src.plugin_system.health_monitor import PluginHealthMonitor
|
||||
from src.wifi_manager import WiFiManager
|
||||
|
||||
# Create Flask app
|
||||
app = Flask(__name__)
|
||||
@@ -51,10 +50,8 @@ try:
|
||||
except ImportError:
|
||||
# flask-limiter not installed, rate limiting disabled
|
||||
limiter = None
|
||||
pass
|
||||
|
||||
# Import cache functions from separate module to avoid circular imports
|
||||
from web_interface.cache import get_cached, set_cached, invalidate_cache
|
||||
|
||||
# Initialize plugin managers - read plugins directory from config
|
||||
config = config_manager.load_config()
|
||||
@@ -304,7 +301,6 @@ try:
|
||||
except ImportError:
|
||||
# Logging config not available, use default
|
||||
log_api_request = None
|
||||
pass
|
||||
|
||||
# Request timing and logging middleware
|
||||
@app.before_request
|
||||
@@ -546,7 +542,7 @@ def display_preview_generator():
|
||||
}
|
||||
last_modified = current_modified
|
||||
yield preview_data
|
||||
except Exception as read_err:
|
||||
except Exception:
|
||||
# File might be being written, skip this update
|
||||
pass
|
||||
else:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from flask import Blueprint, request, jsonify, Response, send_from_directory
|
||||
from flask import Blueprint, request, jsonify, Response
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@@ -17,10 +17,8 @@ logger = logging.getLogger(__name__)
|
||||
from src.web_interface.api_helpers import success_response, error_response, validate_request_json
|
||||
from src.web_interface.errors import ErrorCode
|
||||
from src.plugin_system.operation_types import OperationType
|
||||
from src.web_interface.logging_config import log_plugin_operation, log_config_change
|
||||
from src.web_interface.validators import (
|
||||
validate_image_url, validate_file_upload, validate_mime_type,
|
||||
validate_numeric_range, validate_string_length, sanitize_plugin_config
|
||||
validate_file_upload
|
||||
)
|
||||
from src.error_aggregator import get_error_aggregator
|
||||
|
||||
@@ -4137,7 +4135,6 @@ def save_plugin_config():
|
||||
current_value = array_value # Update for length check below
|
||||
except (ValueError, KeyError, TypeError) as e:
|
||||
logger.debug(f"Failed to convert {prop_key} to array: {e}")
|
||||
pass
|
||||
|
||||
# If it's an array, ensure correct types and check minItems
|
||||
if isinstance(current_value, list):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from flask import Blueprint, render_template, request, redirect, url_for, flash, jsonify
|
||||
from flask import Blueprint, render_template, flash
|
||||
import json
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
@@ -6,7 +6,7 @@ import logging
|
||||
import json
|
||||
import sys
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class JSONFormatter(logging.Formatter):
|
||||
|
||||
Reference in New Issue
Block a user