From b3250293bbfa319cd406b88cffb0fc23963e65db Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 4 Oct 2025 16:36:48 +0200 Subject: [PATCH 1/2] pre-commit autoupdate 2025-10-04 --- .pre-commit-config.yaml | 4 ++-- supervision/annotators/core.py | 6 +++--- supervision/detection/utils/masks.py | 2 +- supervision/tracker/byte_tracker/core.py | 2 +- supervision/utils/notebook.py | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 87528b7e4..7304c3f18 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: trailing-whitespace exclude: test/.*\.py @@ -32,7 +32,7 @@ repos: additional_dependencies: ["bandit[toml]"] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.12.5 + rev: v0.13.3 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 900d823b2..26762e086 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -764,7 +764,7 @@ def annotate( """ assert isinstance(scene, np.ndarray) for detection_idx in range(len(detections)): - x1, y1, x2, y2 = detections.xyxy[detection_idx].astype(int) + x1, _y1, x2, y2 = detections.xyxy[detection_idx].astype(int) color = resolve_color( color=self.color, detections=detections, @@ -1621,7 +1621,7 @@ def _draw_labels( ) # Move to the next line position - left, top, right, bottom = draw.textbbox((0, 0), line, font=self.font) + _left, top, _right, bottom = draw.textbbox((0, 0), line, font=self.font) line_height = bottom - top y_position += line_height + self.text_padding @@ -1917,7 +1917,7 @@ def annotate( if len(xy) > 3 and self.smooth: x, y = xy[:, 0], xy[:, 1] - tck, u = splprep([x, y], s=20) + tck, _u = splprep([x, y], s=20) x_new, y_new = splev(np.linspace(0, 1, 100), tck) spline_points = np.stack([x_new, y_new], axis=1).astype(np.int32) diff --git a/supervision/detection/utils/masks.py b/supervision/detection/utils/masks.py index c5cfee017..c9871b7f2 100644 --- a/supervision/detection/utils/masks.py +++ b/supervision/detection/utils/masks.py @@ -98,7 +98,7 @@ def calculate_masks_centroids(masks: np.ndarray) -> np.ndarray: A 2D NumPy array of shape (num_masks, 2), where each row contains the x and y coordinates (in that order) of the centroid of the corresponding mask. """ - num_masks, height, width = masks.shape + _num_masks, height, width = masks.shape total_pixels = masks.sum(axis=(1, 2)) # offset for 1-based indexing diff --git a/supervision/tracker/byte_tracker/core.py b/supervision/tracker/byte_tracker/core.py index 9c75299ee..482d33e35 100644 --- a/supervision/tracker/byte_tracker/core.py +++ b/supervision/tracker/byte_tracker/core.py @@ -247,7 +247,7 @@ def update_with_tensors(self, tensors: np.ndarray) -> list[STrack]: if strack_pool[i].state == TrackState.Tracked ] dists = matching.iou_distance(r_tracked_stracks, detections_second) - matches, u_track, u_detection_second = matching.linear_assignment( + matches, u_track, _u_detection_second = matching.linear_assignment( dists, thresh=0.5 ) for itracked, idet in matches: diff --git a/supervision/utils/notebook.py b/supervision/utils/notebook.py index 3af09ebbe..9c95a4324 100644 --- a/supervision/utils/notebook.py +++ b/supervision/utils/notebook.py @@ -98,7 +98,7 @@ def plot_images_grid( " or reduce the number of images." ) - fig, axes = plt.subplots(nrows=nrows, ncols=ncols, figsize=size) + _fig, axes = plt.subplots(nrows=nrows, ncols=ncols, figsize=size) for idx, ax in enumerate(axes.flat): if idx < len(images): From 27461179b547bbaad2430030598d0c3f55b8a2e3 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 4 Oct 2025 16:47:20 +0200 Subject: [PATCH 2/2] Rename ruff hook to ruff-check in pre-commit config --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7304c3f18..7c584a775 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.13.3 hooks: - - id: ruff + - id: ruff-check args: [--fix, --exit-non-zero-on-fix] - id: ruff-format types_or: [ python, pyi, jupyter ]