Переглянути джерело

Fix ruff lint errors: remove unused imports and bare except

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
tuanchris 4 місяців тому
батько
коміт
e631e81411

+ 1 - 1
dune-weaver-touch/backend.py

@@ -1362,7 +1362,7 @@ class Backend(QObject):
                     logger.info(f"Auto-detected max brightness: {self._lcd_max_brightness}")
                 else:
                     self._lcd_max_brightness = 255  # Sensible fallback
-                    logger.warning(f"Could not read max_brightness, defaulting to 255")
+                    logger.warning("Could not read max_brightness, defaulting to 255")
             except Exception as e:
                 self._lcd_max_brightness = 255
                 logger.warning(f"Failed to read max_brightness: {e}, defaulting to 255")

+ 0 - 2
main.py

@@ -296,9 +296,7 @@ async def lifespan(app: FastAPI):
         idle (no pattern or playlist active). Without this, LEDs would stay on all night
         if the table was idle when the quiet period began.
         """
-        import time
         from modules.core.pattern_manager import is_in_scheduled_pause_period, start_idle_led_timeout
-        from modules.led.idle_timeout_manager import idle_timeout_manager
 
         was_in_still_sands = False
         while True:

+ 0 - 2
modules/core/playlist_manager.py

@@ -1,12 +1,10 @@
 import json
 import os
-import threading
 import logging
 import asyncio
 from typing import Optional
 from modules.core import pattern_manager
 from modules.core.state import state
-from fastapi import HTTPException
 
 # Configure logging
 logger = logging.getLogger(__name__)

+ 1 - 1
modules/core/preview.py

@@ -32,7 +32,7 @@ def _generate_preview(pattern_file, format='WEBP'):
             text_height = bbox[3] - bbox[1]
             text_x = (DISPLAY_SIZE - text_width) / 2
             text_y = (DISPLAY_SIZE - text_height) / 2
-        except:
+        except Exception:
             text_x = DISPLAY_SIZE / 4 
             text_y = DISPLAY_SIZE / 2
         draw.text((text_x, text_y), text, fill="black")

+ 1 - 2
modules/core/version_manager.py

@@ -9,11 +9,10 @@ Testing overrides (environment variables):
 
 import asyncio
 import aiohttp
-import json
 import os
 import time
 from pathlib import Path
-from typing import Dict, Optional
+from typing import Dict
 import logging
 
 logger = logging.getLogger(__name__)

+ 1 - 1
modules/led/dw_led_controller.py

@@ -7,7 +7,7 @@ import time
 import logging
 from typing import Optional, Dict, List, Tuple
 from .dw_leds.segment import Segment
-from .dw_leds.effects.basic_effects import get_effect, get_all_effects, FRAMETIME
+from .dw_leds.effects.basic_effects import get_effect, get_all_effects
 from .dw_leds.utils.palettes import get_palette_name, PALETTE_NAMES
 from .dw_leds.utils.colors import rgb_to_color
 

+ 0 - 1
modules/led/dw_leds/effects/basic_effects.py

@@ -5,7 +5,6 @@ Effects 0-30: Static, Blink, Rainbow, Scan, etc.
 Ported from WLED FX.cpp
 """
 import random
-import math
 from ..segment import Segment
 from ..utils.colors import *