Corrected type hints

This commit is contained in:
Andrew Murray 2024-07-20 19:07:42 +10:00
parent 882a196a8f
commit 38458a204c
4 changed files with 6 additions and 4 deletions

View File

@ -85,7 +85,9 @@ def test_exif(test_file: str) -> None:
im_reloaded = roundtrip(im_original, save_all=True, exif=im_original.getexif()) im_reloaded = roundtrip(im_original, save_all=True, exif=im_original.getexif())
for im in (im_original, im_reloaded): for im in (im_original, im_reloaded):
assert isinstance(im, MpoImagePlugin.MpoImageFile)
info = im._getexif() info = im._getexif()
assert info is not None
assert info[272] == "Nintendo 3DS" assert info[272] == "Nintendo 3DS"
assert info[296] == 2 assert info[296] == 2
assert info[34665] == 188 assert info[34665] == 188

View File

@ -468,7 +468,7 @@ class JpegImageFile(ImageFile.ImageFile):
self.tile = [] self.tile = []
def _getexif(self) -> dict[str, Any] | None: def _getexif(self) -> dict[int, Any] | None:
return _getexif(self) return _getexif(self)
def _read_dpi_from_exif(self) -> None: def _read_dpi_from_exif(self) -> None:
@ -504,7 +504,7 @@ class JpegImageFile(ImageFile.ImageFile):
return _getmp(self) return _getmp(self)
def _getexif(self: JpegImageFile) -> dict[str, Any] | None: def _getexif(self: JpegImageFile) -> dict[int, Any] | None:
if "exif" not in self.info: if "exif" not in self.info:
return None return None
return self.getexif()._get_merged_dict() return self.getexif()._get_merged_dict()

View File

@ -1054,7 +1054,7 @@ class PngImageFile(ImageFile.ImageFile):
self._prev_im.paste(updated, self.dispose_extent, mask) self._prev_im.paste(updated, self.dispose_extent, mask)
self.im = self._prev_im self.im = self._prev_im
def _getexif(self) -> dict[str, Any] | None: def _getexif(self) -> dict[int, Any] | None:
if "exif" not in self.info: if "exif" not in self.info:
self.load() self.load()
if "exif" not in self.info and "Raw profile type exif" not in self.info: if "exif" not in self.info and "Raw profile type exif" not in self.info:

View File

@ -96,7 +96,7 @@ class WebPImageFile(ImageFile.ImageFile):
# Initialize seek state # Initialize seek state
self._reset(reset=False) self._reset(reset=False)
def _getexif(self) -> dict[str, Any] | None: def _getexif(self) -> dict[int, Any] | None:
if "exif" not in self.info: if "exif" not in self.info:
return None return None
return self.getexif()._get_merged_dict() return self.getexif()._get_merged_dict()