Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added type hints to FitsImagePlugin #7714

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -3484,7 +3484,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
Loading