Skip to content

Commit 1e00c03

Browse files
authored
Merge pull request #7727 from radarhere/type_hints
2 parents 20830c5 + d8c7af0 commit 1e00c03

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/PIL/GdImageFile.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ class is not registered for use with :py:func:`PIL.Image.open()`. To open a
2727
"""
2828
from __future__ import annotations
2929

30+
from io import BytesIO
31+
3032
from . import ImageFile, ImagePalette, UnidentifiedImageError
3133
from ._binary import i16be as i16
3234
from ._binary import i32be as i32
@@ -43,8 +45,10 @@ class GdImageFile(ImageFile.ImageFile):
4345
format = "GD"
4446
format_description = "GD uncompressed images"
4547

46-
def _open(self):
48+
def _open(self) -> None:
4749
# Header
50+
assert self.fp is not None
51+
4852
s = self.fp.read(1037)
4953

5054
if i16(s) not in [65534, 65535]:
@@ -76,7 +80,7 @@ def _open(self):
7680
]
7781

7882

79-
def open(fp, mode="r"):
83+
def open(fp: BytesIO, mode: str = "r") -> GdImageFile:
8084
"""
8185
Load texture from a GD image file.
8286

0 commit comments

Comments
 (0)