From bf4579dc31ce5ebb7d88833189ac854d73fdc8f5 Mon Sep 17 00:00:00 2001 From: Anai-Guo Date: Sat, 12 Sep 2026 06:51:54 -0700 Subject: [PATCH] fix(models): repair __all__ so `from model_api.models import *` works model_api.models.__all__ lists four names the module does not define, so a star-import fails outright: >>> from model_api.models import * AttributeError: module 'model_api.models' has no attribute 'Label' The four fall into two groups. Label is real - result/__init__.py exports it and it is used across the package (classification.py, action_classification.py) - it was just never re-exported here. Added it to the `from .result import (...)` block. The other three are stale: * YOLOv3ONNX / YOLOv4 are mis-cased copies of YoloV3ONNX / YoloV4, the names yolo.py actually defines and which __all__ already lists a few lines further down. * SalientObjectDetectionModel appears nowhere else in the repository - not in any module, test or doc - so it is a leftover from a class that no longer exists. Removed all three from __all__. Verified against the tree: before the change `from model_api.models import *` raises AttributeError; after it binds 47 names, every __all__ entry resolves via hasattr, and __all__ has no duplicates. ruff (v0.6.2, the pinned pre-commit revision, run from the package root so it picks up model_api/pyproject.toml) reports the same three pre-existing errors before and after, and `ruff format --check` is clean. +1/-3, single file. Co-Authored-By: Claude Opus 5 (1M context) --- model_api/src/model_api/models/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/model_api/src/model_api/models/__init__.py b/model_api/src/model_api/models/__init__.py index 0d4e62f4..ad83f3be 100644 --- a/model_api/src/model_api/models/__init__.py +++ b/model_api/src/model_api/models/__init__.py @@ -19,6 +19,7 @@ DetectionResult, ImageResultWithSoftPrediction, InstanceSegmentationResult, + Label, PredictedMask, RotatedSegmentationResult, VisualPromptingResult, @@ -89,7 +90,6 @@ "SAMImageEncoder", "SAMLearnableVisualPrompter", "SAMVisualPrompter", - "SalientObjectDetectionModel", "segmentation_models", "SegmentationModel", "SSD", @@ -100,8 +100,6 @@ "YOLODETR", "YOLOSeg", "YOLOF", - "YOLOv3ONNX", - "YOLOv4", "YOLOv5", "YOLOv8", "YOLOX",