Skip to content

Commit

Permalink
Merge pull request #7714 from radarhere/type_hints_fits
Browse files Browse the repository at this point in the history
Added type hints to FitsImagePlugin
  • Loading branch information
mergify[bot] authored Jan 14, 2024
2 parents 1d25a39 + ffd0363 commit ed9e29d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/PIL/FitsImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@
from . import Image, ImageFile


def _accept(prefix):
def _accept(prefix: bytes) -> bool:
return prefix[:6] == b"SIMPLE"


class FitsImageFile(ImageFile.ImageFile):
format = "FITS"
format_description = "FITS"

def _open(self):
headers = {}
def _open(self) -> None:
assert self.fp is not None

headers: dict[bytes, bytes] = {}
while True:
header = self.fp.read(80)
if not header:
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -3486,7 +3486,7 @@ def register_extension(id, extension) -> None:
EXTENSION[extension.lower()] = id.upper()


def register_extensions(id, extensions):
def register_extensions(id, extensions) -> None:
"""
Registers image extensions. This function should not be
used in application code.
Expand Down

0 comments on commit ed9e29d

Please sign in to comment.