From 9f725eb79f0815bad386460cf48a523cf5a3acd5 Mon Sep 17 00:00:00 2001 From: Yixing Lao Date: Fri, 10 Jan 2025 20:42:01 +0800 Subject: [PATCH] refactor(image.py): add Literal type hint for alignment parameter in vstack_images to enforce valid values chore(image.py): update typing imports to include Literal for better type safety --- camtools/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/camtools/image.py b/camtools/image.py index 3e79c470..a715779e 100644 --- a/camtools/image.py +++ b/camtools/image.py @@ -6,7 +6,7 @@ import cv2 from . import sanity from . import colormap -from typing import Tuple, List, Optional, Union +from typing import Tuple, List, Optional, Union, Literal from jaxtyping import Float, UInt8, UInt16, Int @@ -778,7 +778,7 @@ def get_scales(im_height, max_lines, font, line_text_h_ratio): def vstack_images( ims: List[Float[np.ndarray, "h w 3"]], - alignment: str = "left", + alignment: Literal["left", "center", "right"] = "left", background_color: Tuple[float, float, float] = (1.0, 1.0, 1.0), ) -> Float[np.ndarray, "h_stacked w_stacked 3"]: """