From a618b7c36935950eef055d807d3d05970dbed159 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 6 Dec 2023 12:34:54 +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/__init__.py | 2 +- supervision/annotators/core.py | 33 ++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/supervision/__init__.py b/supervision/__init__.py index 4d924acf..85b07850 100644 --- a/supervision/__init__.py +++ b/supervision/__init__.py @@ -21,7 +21,7 @@ from supervision.annotators.core import ( PixelateAnnotator, PolygonAnnotator, TraceAnnotator, - TriangleAnnotator + TriangleAnnotator, ) from supervision.annotators.utils import ColorLookup from supervision.classification.core import Classifications diff --git a/supervision/annotators/core.py b/supervision/annotators/core.py index 23ba9554..45241b97 100644 --- a/supervision/annotators/core.py +++ b/supervision/annotators/core.py @@ -1271,12 +1271,12 @@ class TriangleAnnotator(BaseAnnotator): """ def __init__( - self, - color: Union[Color, ColorPalette] = ColorPalette.default(), - base: int = 10, - height: int = 10, - position: Position = Position.CENTER, - color_lookup: ColorLookup = ColorLookup.CLASS, + self, + color: Union[Color, ColorPalette] = ColorPalette.default(), + base: int = 10, + height: int = 10, + position: Position = Position.CENTER, + color_lookup: ColorLookup = ColorLookup.CLASS, ): """ Args: @@ -1295,10 +1295,10 @@ class TriangleAnnotator(BaseAnnotator): self.color_lookup: ColorLookup = color_lookup def annotate( - self, - scene: np.ndarray, - detections: Detections, - custom_color_lookup: Optional[np.ndarray] = None, + self, + scene: np.ndarray, + detections: Detections, + custom_color_lookup: Optional[np.ndarray] = None, ) -> np.ndarray: """ Annotates the given scene with triangles based on the provided detections. @@ -1323,11 +1323,14 @@ class TriangleAnnotator(BaseAnnotator): else custom_color_lookup, ) center_x, center_y = int(xy[detection_idx, 0]), int(xy[detection_idx, 1]) - vertices = np.array([ - [center_x, center_y - self.height // 2], - [center_x - self.base // 2, center_y + self.height // 2], - [center_x + self.base // 2, center_y + self.height // 2] - ], np.int32) + vertices = np.array( + [ + [center_x, center_y - self.height // 2], + [center_x - self.base // 2, center_y + self.height // 2], + [center_x + self.base // 2, center_y + self.height // 2], + ], + np.int32, + ) cv2.fillPoly(scene, [vertices], color.as_bgr())