Skip to content

Commit

Permalink
Corrected type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jul 20, 2024
1 parent 882a196 commit 38458a2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Tests/test_file_mpo.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ def test_exif(test_file: str) -> None:
im_reloaded = roundtrip(im_original, save_all=True, exif=im_original.getexif())

for im in (im_original, im_reloaded):
assert isinstance(im, MpoImagePlugin.MpoImageFile)
info = im._getexif()
assert info is not None
assert info[272] == "Nintendo 3DS"
assert info[296] == 2
assert info[34665] == 188
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/JpegImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def load_djpeg(self) -> None:

self.tile = []

def _getexif(self) -> dict[str, Any] | None:
def _getexif(self) -> dict[int, Any] | None:
return _getexif(self)

def _read_dpi_from_exif(self) -> None:
Expand Down Expand Up @@ -504,7 +504,7 @@ def _getmp(self) -> dict[int, Any] | None:
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:
return None
return self.getexif()._get_merged_dict()
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/PngImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ def load_end(self) -> None:
self._prev_im.paste(updated, self.dispose_extent, mask)
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:
self.load()
if "exif" not in self.info and "Raw profile type exif" not in self.info:
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/WebPImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def _open(self) -> None:
# Initialize seek state
self._reset(reset=False)

def _getexif(self) -> dict[str, Any] | None:
def _getexif(self) -> dict[int, Any] | None:
if "exif" not in self.info:
return None
return self.getexif()._get_merged_dict()
Expand Down

0 comments on commit 38458a2

Please sign in to comment.