Skip to content

Commit 622722f

Browse files
committed
Corrected loadImageSeries type hint
1 parent 0e3f51d commit 622722f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/PIL/SpiderImagePlugin.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -211,26 +211,27 @@ def tkPhotoImage(self) -> ImageTk.PhotoImage:
211211

212212

213213
# given a list of filenames, return a list of images
214-
def loadImageSeries(filelist: list[str] | None = None) -> list[SpiderImageFile] | None:
214+
def loadImageSeries(filelist: list[str] | None = None) -> list[Image.Image] | None:
215215
"""create a list of :py:class:`~PIL.Image.Image` objects for use in a montage"""
216216
if filelist is None or len(filelist) < 1:
217217
return None
218218

219-
imglist = []
219+
byte_imgs = []
220220
for img in filelist:
221221
if not os.path.exists(img):
222222
print(f"unable to find {img}")
223223
continue
224224
try:
225225
with Image.open(img) as im:
226-
im = im.convert2byte()
226+
assert isinstance(im, SpiderImageFile)
227+
byte_im = im.convert2byte()
227228
except Exception:
228229
if not isSpiderImage(img):
229230
print(f"{img} is not a Spider image file")
230231
continue
231-
im.info["filename"] = img
232-
imglist.append(im)
233-
return imglist
232+
byte_im.info["filename"] = img
233+
byte_imgs.append(byte_im)
234+
return byte_imgs
234235

235236

236237
# --------------------------------------------------------------------

0 commit comments

Comments
 (0)