Skip to content

Commit

Permalink
fix(pre_commit): 🎨 auto format pre-commit hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Mar 15, 2024
1 parent a5b1079 commit 9f5c63b
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions supervision/annotators/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ def __init__(
scale_factor: int = 2,
color: Union[Color, ColorPalette] = ColorPalette.DEFAULT,
thickness: int = 2,
color_lookup: ColorLookup = ColorLookup.CLASS
color_lookup: ColorLookup = ColorLookup.CLASS,
):
"""
Args:
Expand Down Expand Up @@ -1948,47 +1948,35 @@ def calculate_crop_coordinates(
width, height = crop_wh

if position == Position.TOP_LEFT:
return (
(anchor_x - width, anchor_y - height),
(anchor_x, anchor_y)
)
return ((anchor_x - width, anchor_y - height), (anchor_x, anchor_y))
elif position == Position.TOP_CENTER:
return (
(anchor_x - width // 2, anchor_y - height),
(anchor_x + width // 2, anchor_y)
(anchor_x + width // 2, anchor_y),
)
elif position == Position.TOP_RIGHT:
return (
(anchor_x, anchor_y - height),
(anchor_x + width, anchor_y)
)
return ((anchor_x, anchor_y - height), (anchor_x + width, anchor_y))
elif position == Position.CENTER_LEFT:
return (
(anchor_x - width, anchor_y - height // 2),
(anchor_x, anchor_y + height // 2)
(anchor_x, anchor_y + height // 2),
)
elif position == Position.CENTER or position == Position.CENTER_OF_MASS:
return (
(anchor_x - width // 2, anchor_y - height // 2),
(anchor_x + width // 2, anchor_y + height // 2)
(anchor_x + width // 2, anchor_y + height // 2),
)
elif position == Position.CENTER_RIGHT:
return (
(anchor_x, anchor_y - height // 2),
(anchor_x + width, anchor_y + height // 2)
(anchor_x + width, anchor_y + height // 2),
)
elif position == Position.BOTTOM_LEFT:
return (
(anchor_x - width, anchor_y),
(anchor_x, anchor_y + height)
)
return ((anchor_x - width, anchor_y), (anchor_x, anchor_y + height))
elif position == Position.BOTTOM_CENTER:
return (
(anchor_x - width // 2, anchor_y),
(anchor_x + width // 2, anchor_y + height)
(anchor_x + width // 2, anchor_y + height),
)
elif position == Position.BOTTOM_RIGHT:
return (
(anchor_x, anchor_y),
(anchor_x + width, anchor_y + height)
)
return ((anchor_x, anchor_y), (anchor_x + width, anchor_y + height))

0 comments on commit 9f5c63b

Please sign in to comment.