Skip to content

Commit

Permalink
refactor(image.py): add Literal type hint for alignment parameter in …
Browse files Browse the repository at this point in the history
…vstack_images to enforce valid values

chore(image.py): update typing imports to include Literal for better type safety
  • Loading branch information
yxlao committed Jan 10, 2025
1 parent 86d3439 commit 9f725eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions camtools/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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"]:
"""
Expand Down

0 comments on commit 9f725eb

Please sign in to comment.