Formatting

This commit is contained in:
Nick Mowen 2023-09-29 16:27:25 -06:00
parent 26b1bc8fc0
commit 90850267d2
2 changed files with 5 additions and 2 deletions

View File

@ -51,6 +51,7 @@ def get_standard_aspect_ratio(width: int, height: int) -> tuple[int, int]:
) )
return known_aspects[known_aspects_ratios.index(closest)] return known_aspects[known_aspects_ratios.index(closest)]
def get_canvas_shape(width: int, height: int) -> tuple[int, int]: def get_canvas_shape(width: int, height: int) -> tuple[int, int]:
"""Get birdseye canvas shape.""" """Get birdseye canvas shape."""
canvas_width = width canvas_width = width
@ -60,7 +61,9 @@ def get_canvas_shape(width: int, height: int) -> tuple[int, int]:
if round(a_w / a_h, 2) != round(width / height, 2): if round(a_w / a_h, 2) != round(width / height, 2):
canvas_width = width canvas_width = width
canvas_height = (canvas_width / a_w) * a_h canvas_height = (canvas_width / a_w) * a_h
logger.warning(f"The birdseye resolution is a non-standard aspect ratio, forcing birdseye resolution to {canvas_width} x {canvas_height}") logger.warning(
f"The birdseye resolution is a non-standard aspect ratio, forcing birdseye resolution to {canvas_width} x {canvas_height}"
)
return (canvas_width, canvas_height) return (canvas_width, canvas_height)

View File

@ -43,5 +43,5 @@ class TestBirdseye(unittest.TestCase):
width = 1280 width = 1280
height = 840 height = 840
canvas_width, canvas_height = get_canvas_shape(width, height) canvas_width, canvas_height = get_canvas_shape(width, height)
assert canvas_width == width # width will be the same assert canvas_width == width # width will be the same
assert canvas_height != height assert canvas_height != height