Added type hints

This commit is contained in:
Andrew Murray 2024-01-13 16:26:15 +11:00
parent 9923531742
commit ffd0363b65
2 changed files with 6 additions and 4 deletions

View File

@ -15,7 +15,7 @@ import math
from . import Image, ImageFile from . import Image, ImageFile
def _accept(prefix): def _accept(prefix: bytes) -> bool:
return prefix[:6] == b"SIMPLE" return prefix[:6] == b"SIMPLE"
@ -23,8 +23,10 @@ class FitsImageFile(ImageFile.ImageFile):
format = "FITS" format = "FITS"
format_description = "FITS" format_description = "FITS"
def _open(self): def _open(self) -> None:
headers = {} assert self.fp is not None
headers: dict[bytes, bytes] = {}
while True: while True:
header = self.fp.read(80) header = self.fp.read(80)
if not header: if not header:

View File

@ -3484,7 +3484,7 @@ def register_extension(id, extension) -> None:
EXTENSION[extension.lower()] = id.upper() EXTENSION[extension.lower()] = id.upper()
def register_extensions(id, extensions): def register_extensions(id, extensions) -> None:
""" """
Registers image extensions. This function should not be Registers image extensions. This function should not be
used in application code. used in application code.