Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,9 +32,9 @@ 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
- id: ruff-check
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why we change ruff to ruff-check here?

args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
types_or: [ python, pyi, jupyter ]
Expand Down
6 changes: 3 additions & 3 deletions supervision/annotators/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion supervision/detection/utils/masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion supervision/tracker/byte_tracker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion supervision/utils/notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down