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:
Will Miao
2026-08-08 20:12:52 +08:00
parent 6fcdeb799d
commit 8e724538bd
103 changed files with 1184 additions and 1015 deletions

View File

@@ -101,6 +101,7 @@ class RecipeAnalysisService:
temp_path = None
metadata: Optional[dict[str, Any]] = None
image_info: Optional[dict[str, Any]] = None
is_video = False
extension = ".jpg" # Default
@@ -413,7 +414,7 @@ class RecipeAnalysisService:
error_msg = "This image does not contain any generation metadata (prompt, models, or parameters)"
else:
error_msg = "No parser found for this image"
payload = {"error": error_msg, "loras": []}
payload: dict[str, Any] = {"error": error_msg, "loras": []}
if include_image_base64 and image_path:
payload["image_base64"] = self._encode_file(image_path)
payload["is_video"] = is_video
@@ -494,7 +495,7 @@ class RecipeAnalysisService:
getattr(tensor_image, "dtype", None),
)
import torch # type: ignore[import-not-found]
import torch # pyright: ignore[reportMissingImports]
if isinstance(tensor_image, torch.Tensor):
image_np = tensor_image.cpu().numpy()