mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-13 01:05:48 +03:00
Replace NotImplementedError with abstractmethod
This commit is contained in:
parent
2309f0fa60
commit
d186a2a8d6
|
@ -447,7 +447,7 @@ class StubHandler(abc.ABC):
|
|||
pass
|
||||
|
||||
|
||||
class StubImageFile(ImageFile):
|
||||
class StubImageFile(ImageFile, metaclass=abc.ABCMeta):
|
||||
"""
|
||||
Base class for stub image loaders.
|
||||
|
||||
|
@ -455,9 +455,9 @@ class StubImageFile(ImageFile):
|
|||
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()
|
||||
|
@ -471,10 +471,10 @@ class StubImageFile(ImageFile):
|
|||
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:
|
||||
|
|
Loading…
Reference in New Issue
Block a user