Skip to content
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
2 changes: 1 addition & 1 deletion src/PIL/BlpImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def _open(self) -> None:
self.tile = [ImageFile._Tile(decoder, (0, 0) + self.size, offset, args)]


class _BLPBaseDecoder(ImageFile.PyDecoder):
class _BLPBaseDecoder(abc.ABC, ImageFile.PyDecoder):
_pulls_fd = True

def decode(self, buffer: bytes | Image.SupportsArrayInterface) -> tuple[int, int]:
Expand Down
4 changes: 2 additions & 2 deletions src/PIL/Image.py
Original file line number Diff line number Diff line change
Expand Up @@ -2966,7 +2966,7 @@ def toqpixmap(self) -> ImageQt.QPixmap:
# Abstract handlers.


class ImagePointHandler:
class ImagePointHandler(abc.ABC):
"""
Used as a mixin by point transforms
(for use with :py:meth:`~PIL.Image.Image.point`)
Expand All @@ -2977,7 +2977,7 @@ def point(self, im: Image) -> Image:
pass


class ImageTransformHandler:
class ImageTransformHandler(abc.ABC):
"""
Used as a mixin by geometry transforms
(for use with :py:meth:`~PIL.Image.Image.transform`)
Expand Down
12 changes: 6 additions & 6 deletions src/PIL/ImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def _seek_check(self, frame: int) -> bool:
return self.tell() != frame


class StubHandler:
class StubHandler(abc.ABC):
def open(self, im: StubImageFile) -> None:
pass

Expand All @@ -447,17 +447,17 @@ def load(self, im: StubImageFile) -> Image.Image:
pass


class StubImageFile(ImageFile):
class StubImageFile(ImageFile, metaclass=abc.ABCMeta):
"""
Base class for stub image loaders.

A stub loader is an image loader that can identify files of a
certain format, but relies on external code to load the file.
"""

@abc.abstractmethod
def _open(self) -> None:
msg = "StubImageFile subclass must implement _open"
raise NotImplementedError(msg)
pass

def load(self) -> Image.core.PixelAccess | None:
loader = self._load()
Expand All @@ -471,10 +471,10 @@ def load(self) -> Image.core.PixelAccess | None:
self.__dict__ = image.__dict__
return image.load()

@abc.abstractmethod
def _load(self) -> StubHandler | None:
"""(Hook) Find actual image loader."""
msg = "StubImageFile subclass must implement _load"
raise NotImplementedError(msg)
pass


class Parser:
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from ._typing import NumpyArray


class Filter:
class Filter(abc.ABC):
@abc.abstractmethod
def filter(self, image: _imaging.ImagingCore) -> _imaging.ImagingCore:
pass
Expand Down
2 changes: 1 addition & 1 deletion src/PIL/ImageShow.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def show_file(self, path: str, **options: Any) -> int:
register(MacViewer)


class UnixViewer(Viewer):
class UnixViewer(abc.ABC, Viewer):
format = "PNG"
options = {"compress_level": 1, "save_all": True}

Expand Down
Loading