mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-08 23:10:15 -03:00
fix(types): resolve pre-existing basedpyright errors in py/ and standalone.py
Fix ~950 basedpyright errors across the backend: - Convert ineffective # type: ignore comments to # pyright: ignore[rule] - Add missing generic type arguments (Dict[str, Any], list[Any], ...) - Annotate dynamic dict literals and runtime-initialized attributes - Widen CivitAI provider tuple signatures in recipe parsers - Remove dead LoraRoutes handlers calling nonexistent LoraService methods - Suppress unavoidable ServiceRegistry import cycles (basedpyright counts function-local imports as cycle edges)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
from aiohttp import web
|
||||
from typing import Set, Dict, Optional
|
||||
from typing import Set, Dict, Optional, Any
|
||||
from uuid import uuid4
|
||||
import asyncio
|
||||
from datetime import datetime, timedelta
|
||||
@@ -15,13 +15,13 @@ class WebSocketManager:
|
||||
self._init_websockets: Set[web.WebSocketResponse] = set() # New set for initialization progress clients
|
||||
self._download_websockets: Dict[str, web.WebSocketResponse] = {} # New dict for download-specific clients
|
||||
# Add progress tracking dictionary
|
||||
self._download_progress: Dict[str, Dict] = {}
|
||||
self._download_progress: Dict[str, Dict[str, Any]] = {}
|
||||
# Cache last initialization progress payloads
|
||||
self._last_init_progress: Dict[str, Dict] = {}
|
||||
self._last_init_progress: Dict[str, Dict[str, Any]] = {}
|
||||
# Add auto-organize progress tracking
|
||||
self._auto_organize_progress: Optional[Dict] = None
|
||||
self._auto_organize_progress: Optional[Dict[str, Any]] = None
|
||||
# Add recipe repair progress tracking
|
||||
self._recipe_repair_progress: Optional[Dict] = None
|
||||
self._recipe_repair_progress: Optional[Dict[str, Any]] = None
|
||||
self._auto_organize_lock = asyncio.Lock()
|
||||
|
||||
async def handle_connection(self, request: web.Request) -> web.WebSocketResponse:
|
||||
@@ -95,7 +95,7 @@ class WebSocketManager:
|
||||
self.cleanup_download_progress(download_id)
|
||||
logger.debug(f"Delayed cleanup completed for download {download_id}")
|
||||
|
||||
async def broadcast(self, data: Dict):
|
||||
async def broadcast(self, data: Dict[str, Any]):
|
||||
"""Broadcast message to all connected clients"""
|
||||
if not self._websockets:
|
||||
return
|
||||
@@ -106,7 +106,7 @@ class WebSocketManager:
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending progress: {e}")
|
||||
|
||||
async def broadcast_init_progress(self, data: Dict):
|
||||
async def broadcast_init_progress(self, data: Dict[str, Any]):
|
||||
"""Broadcast initialization progress to connected clients"""
|
||||
payload = dict(data) if data else {}
|
||||
|
||||
@@ -145,7 +145,7 @@ class WebSocketManager:
|
||||
except Exception as e:
|
||||
logger.debug(f'Error sending cached initialization progress: {e}')
|
||||
|
||||
def _get_init_progress_key(self, data: Dict) -> str:
|
||||
def _get_init_progress_key(self, data: Dict[str, Any]) -> str:
|
||||
"""Return a stable key for caching initialization progress payloads"""
|
||||
page_type = data.get('pageType')
|
||||
if page_type:
|
||||
@@ -155,7 +155,7 @@ class WebSocketManager:
|
||||
return f'scanner:{scanner_type}'
|
||||
return 'global'
|
||||
|
||||
async def broadcast_download_progress(self, download_id: str, data: Dict):
|
||||
async def broadcast_download_progress(self, download_id: str, data: Dict[str, Any]):
|
||||
"""Send progress update to specific download client"""
|
||||
progress_entry = {
|
||||
'progress': data.get('progress', 0),
|
||||
@@ -183,7 +183,7 @@ class WebSocketManager:
|
||||
except Exception as e:
|
||||
logger.error(f"Error sending download progress: {e}")
|
||||
|
||||
async def broadcast_auto_organize_progress(self, data: Dict):
|
||||
async def broadcast_auto_organize_progress(self, data: Dict[str, Any]):
|
||||
"""Broadcast auto-organize progress to connected clients"""
|
||||
# Store progress data in memory
|
||||
self._auto_organize_progress = data
|
||||
@@ -191,7 +191,7 @@ class WebSocketManager:
|
||||
# Broadcast via WebSocket
|
||||
await self.broadcast(data)
|
||||
|
||||
async def broadcast_recipe_repair_progress(self, data: Dict):
|
||||
async def broadcast_recipe_repair_progress(self, data: Dict[str, Any]):
|
||||
"""Broadcast recipe repair progress to connected clients"""
|
||||
# Store progress data in memory
|
||||
self._recipe_repair_progress = data
|
||||
@@ -199,7 +199,7 @@ class WebSocketManager:
|
||||
# Broadcast via WebSocket
|
||||
await self.broadcast(data)
|
||||
|
||||
def get_auto_organize_progress(self) -> Optional[Dict]:
|
||||
def get_auto_organize_progress(self) -> Optional[Dict[str, Any]]:
|
||||
"""Get current auto-organize progress"""
|
||||
return self._auto_organize_progress
|
||||
|
||||
@@ -207,7 +207,7 @@ class WebSocketManager:
|
||||
"""Clear auto-organize progress data"""
|
||||
self._auto_organize_progress = None
|
||||
|
||||
def get_recipe_repair_progress(self) -> Optional[Dict]:
|
||||
def get_recipe_repair_progress(self) -> Optional[Dict[str, Any]]:
|
||||
"""Get current recipe repair progress"""
|
||||
return self._recipe_repair_progress
|
||||
|
||||
@@ -234,7 +234,7 @@ class WebSocketManager:
|
||||
"""Get the auto-organize lock"""
|
||||
return self._auto_organize_lock
|
||||
|
||||
def get_download_progress(self, download_id: str) -> Optional[Dict]:
|
||||
def get_download_progress(self, download_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""Get progress information for a specific download"""
|
||||
return self._download_progress.get(download_id)
|
||||
|
||||
@@ -255,7 +255,7 @@ class WebSocketManager:
|
||||
self._download_progress.pop(download_id, None)
|
||||
logger.debug(f"Cleaned up old download progress for {download_id}")
|
||||
|
||||
async def broadcast_cache_health_warning(self, report: 'HealthReport', page_type: str = None):
|
||||
async def broadcast_cache_health_warning(self, report: 'HealthReport', page_type: Optional[str] = None):
|
||||
"""
|
||||
Broadcast cache health warning to frontend.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user