Skip to content

Commit 2dc7de8

Browse files
fix: remove Union references
1 parent 5a6d884 commit 2dc7de8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

fastembed/image/transform/functional.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def pad2square(
150150
def resize_longest_edge(
151151
image: Image.Image,
152152
max_size: int,
153-
resample: Union[int, Image.Resampling] = Image.Resampling.LANCZOS,
153+
resample: int | Image.Resampling = Image.Resampling.LANCZOS,
154154
) -> Image.Image:
155155
height, width = image.height, image.width
156156
aspect_ratio = width / height
@@ -192,7 +192,7 @@ def crop_ndarray(
192192
def resize_ndarray(
193193
image: NumpyArray,
194194
size: tuple[int, int],
195-
resample: Union[int, Image.Resampling] = Image.Resampling.LANCZOS,
195+
resample: int | Image.Resampling = Image.Resampling.LANCZOS,
196196
channel_first: bool = True,
197197
) -> NumpyArray:
198198
# Convert to PIL-friendly format (H, W, C)

fastembed/image/transform/operators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def __init__(self, mean: float | list[float], std: float | list[float]):
4242
self.std = std
4343

4444
def __call__( # type: ignore[override]
45-
self, images: Union[list[NumpyArray], list[list[NumpyArray]]]
46-
) -> Union[list[NumpyArray], list[list[NumpyArray]]]:
45+
self, images: list[NumpyArray] | list[list[NumpyArray]]
46+
) -> list[NumpyArray] | list[list[NumpyArray]]:
4747
if images and isinstance(images[0], list):
4848
# Nested structure from ImageSplitter
4949
return [
@@ -73,8 +73,8 @@ def __init__(self, scale: float = 1 / 255):
7373
self.scale = scale
7474

7575
def __call__( # type: ignore[override]
76-
self, images: Union[list[NumpyArray], list[list[NumpyArray]]]
77-
) -> Union[list[NumpyArray], list[list[NumpyArray]]]:
76+
self, images: list[NumpyArray] | list[list[NumpyArray]]
77+
) -> list[NumpyArray] | list[list[NumpyArray]]:
7878
if images and isinstance(images[0], list):
7979
# Nested structure from ImageSplitter
8080
return [

0 commit comments

Comments
 (0)