From 61cca76acc479124bad10599878f44b6250aa896 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 13 Nov 2025 02:10:19 +0000 Subject: [PATCH] =?UTF-8?q?fix(pre=5Fcommit):=20=F0=9F=8E=A8=20auto=20form?= =?UTF-8?q?at=20pre-commit=20hooks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- supervision/detection/core.py | 5 ++++- test/detection/test_core.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/supervision/detection/core.py b/supervision/detection/core.py index ae6205df..bda2e7de 100644 --- a/supervision/detection/core.py +++ b/supervision/detection/core.py @@ -296,7 +296,10 @@ class Detections: class_id=np.arange(len(ultralytics_results)), ) - if hasattr(ultralytics_results, "boxes") and ultralytics_results.boxes is not None: + if ( + hasattr(ultralytics_results, "boxes") + and ultralytics_results.boxes is not None + ): class_id = ultralytics_results.boxes.cls.cpu().numpy().astype(int) class_names = np.array([ultralytics_results.names[i] for i in class_id]) return cls( diff --git a/test/detection/test_core.py b/test/detection/test_core.py index 1542f0a3..bf27f209 100644 --- a/test/detection/test_core.py +++ b/test/detection/test_core.py @@ -816,6 +816,7 @@ def test_merge_inner_detection_object_pair( result = merge_inner_detection_object_pair(detection_1, detection_2) assert result == expected_result + class TestFromUltralytics: """Test suite for Detections.from_ultralytics method.""" @@ -824,6 +825,7 @@ class TestFromUltralytics: Regression test for issue #2000. """ + # Create a mock ultralytics result without boxes attribute class MockUltralyticsResult: def __init__(self): @@ -839,6 +841,7 @@ class TestFromUltralytics: def test_from_ultralytics_with_boxes_none(self): """Test that from_ultralytics handles boxes=None (segmentation-only models).""" + # Create a mock ultralytics result with boxes=None class MockUltralyticsResult: def __init__(self): @@ -859,6 +862,7 @@ class TestFromUltralytics: def test_from_ultralytics_with_valid_boxes(self): """Test that from_ultralytics works correctly with valid boxes.""" + # Create a mock ultralytics result with valid boxes class MockBoxes: def __init__(self):