Skip to content

Commit

Permalink
Minor type fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Gilbert <[email protected]>
  • Loading branch information
bgilbert committed Oct 18, 2024
1 parent f4b8131 commit 5032e23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions openslide/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class AbstractSlide:
"""The base class of a slide object."""

def __init__(self) -> None:
self._profile = None
self._profile: bytes | None = None

def __enter__(self) -> AbstractSlide:
return self
Expand Down Expand Up @@ -387,7 +387,9 @@ def detect_format(cls, filename: str | bytes | Path) -> str | None:
If the file format is not recognized, return None."""
try:
with Image.open(filename) as img:
return img.format
# img currently resolves as Any
# https://github.com/python-pillow/Pillow/pull/8362
return img.format # type: ignore[no-any-return]
except OSError:
return None

Expand Down

0 comments on commit 5032e23

Please sign in to comment.