Skip to content

Commit 6b10706

Browse files
committed
Fix type annotation mismatches in pil_utils.py and outputs.py
Signed-off-by: Kunjan patel <[email protected]>
1 parent ff35c30 commit 6b10706

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/maxdiffusion/utils/outputs.py

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def is_tensor(x):
3737
return isinstance(x, np.ndarray)
3838

3939

40+
@dataclass
4041
class BaseOutput(OrderedDict):
4142
"""
4243
Base class for all model outputs as dataclass. Has a `__getitem__` that allows indexing by integer or slice (like a

src/maxdiffusion/utils/pil_utils.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
}
1717
else:
1818
PIL_INTERPOLATION = {
19-
"linear": PIL.Image.LINEAR,
20-
"bilinear": PIL.Image.BILINEAR,
21-
"bicubic": PIL.Image.BICUBIC,
22-
"lanczos": PIL.Image.LANCZOS,
23-
"nearest": PIL.Image.NEAREST,
19+
"linear": PIL.Image.LINEAR, # pytype: disable=module-attr
20+
"bilinear": PIL.Image.BILINEAR, # pytype: disable=module-attr
21+
"bicubic": PIL.Image.BICUBIC, # pytype: disable=module-attr
22+
"lanczos": PIL.Image.LANCZOS, # pytype: disable=module-attr
23+
"nearest": PIL.Image.NEAREST, # pytype: disable=module-attr
2424
}
2525

2626

@@ -50,7 +50,7 @@ def numpy_to_pil(images):
5050
return pil_images
5151

5252

53-
def make_image_grid(images: List[PIL.Image.Image], rows: int, cols: int, resize: int = None) -> PIL.Image.Image:
53+
def make_image_grid(images: List[PIL.Image.Image], rows: int, cols: int, resize: int | None = None) -> PIL.Image.Image:
5454
"""
5555
Prepares a single grid of images. Useful for visualization purposes.
5656
"""

0 commit comments

Comments
 (0)