Skip to content

Commit 4005a8e

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 4005a8e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/maxdiffusion/utils/outputs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"""
1717

1818
from collections import OrderedDict
19-
from dataclasses import fields, is_dataclass
19+
from dataclasses import dataclass, fields, is_dataclass
2020
from typing import Any, Tuple
2121

2222
import numpy as np
@@ -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

Lines changed: 6 additions & 6 deletions
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)