diff --git a/.ci/requirements-mypy.txt b/.ci/requirements-mypy.txt index 6dd43248837..776bb0dbbf2 100644 --- a/.ci/requirements-mypy.txt +++ b/.ci/requirements-mypy.txt @@ -1 +1 @@ -mypy==1.10.1 +mypy==1.11.0 diff --git a/Tests/test_file_mpo.py b/Tests/test_file_mpo.py index 5402fcb440d..e0f42a26649 100644 --- a/Tests/test_file_mpo.py +++ b/Tests/test_file_mpo.py @@ -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 diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index e2913e9444f..4958b22228b 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -776,7 +776,7 @@ class MyStdOut: mystdout: MyStdOut | BytesIO = MyStdOut() if buffer else BytesIO() - sys.stdout = mystdout # type: ignore[assignment] + sys.stdout = mystdout with Image.open(TEST_PNG_FILE) as im: im.save(sys.stdout, "PNG") diff --git a/Tests/test_file_ppm.py b/Tests/test_file_ppm.py index d6451ec18b5..0a61830a40a 100644 --- a/Tests/test_file_ppm.py +++ b/Tests/test_file_ppm.py @@ -373,7 +373,7 @@ class MyStdOut: mystdout: MyStdOut | BytesIO = MyStdOut() if buffer else BytesIO() - sys.stdout = mystdout # type: ignore[assignment] + sys.stdout = mystdout with Image.open(TEST_FILE) as im: im.save(sys.stdout, "PPM") diff --git a/Tests/test_psdraw.py b/Tests/test_psdraw.py index 130ffa863a5..c3afa908937 100644 --- a/Tests/test_psdraw.py +++ b/Tests/test_psdraw.py @@ -59,7 +59,7 @@ class MyStdOut: mystdout: MyStdOut | BytesIO = MyStdOut() if buffer else BytesIO() - sys.stdout = mystdout # type: ignore[assignment] + sys.stdout = mystdout ps = PSDraw.PSDraw() _create_document(ps) diff --git a/src/PIL/JpegImagePlugin.py b/src/PIL/JpegImagePlugin.py index af24faa5de2..d83d60b7b1b 100644 --- a/src/PIL/JpegImagePlugin.py +++ b/src/PIL/JpegImagePlugin.py @@ -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: @@ -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() diff --git a/src/PIL/PngImagePlugin.py b/src/PIL/PngImagePlugin.py index 247f908edaa..58db7777c39 100644 --- a/src/PIL/PngImagePlugin.py +++ b/src/PIL/PngImagePlugin.py @@ -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: diff --git a/src/PIL/WebPImagePlugin.py b/src/PIL/WebPImagePlugin.py index 011de9c6ac0..cec7963405b 100644 --- a/src/PIL/WebPImagePlugin.py +++ b/src/PIL/WebPImagePlugin.py @@ -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()