mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-14 15:22:13 +03:00
Replace NotImplementedError with abstractmethod
This commit is contained in:
parent
2309f0fa60
commit
d186a2a8d6
|
@ -447,7 +447,7 @@ class StubHandler(abc.ABC):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class StubImageFile(ImageFile):
|
class StubImageFile(ImageFile, metaclass=abc.ABCMeta):
|
||||||
"""
|
"""
|
||||||
Base class for stub image loaders.
|
Base class for stub image loaders.
|
||||||
|
|
||||||
|
@ -455,9 +455,9 @@ class StubImageFile(ImageFile):
|
||||||
certain format, but relies on external code to load the file.
|
certain format, but relies on external code to load the file.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def _open(self) -> None:
|
def _open(self) -> None:
|
||||||
msg = "StubImageFile subclass must implement _open"
|
pass
|
||||||
raise NotImplementedError(msg)
|
|
||||||
|
|
||||||
def load(self) -> Image.core.PixelAccess | None:
|
def load(self) -> Image.core.PixelAccess | None:
|
||||||
loader = self._load()
|
loader = self._load()
|
||||||
|
@ -471,10 +471,10 @@ class StubImageFile(ImageFile):
|
||||||
self.__dict__ = image.__dict__
|
self.__dict__ = image.__dict__
|
||||||
return image.load()
|
return image.load()
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
def _load(self) -> StubHandler | None:
|
def _load(self) -> StubHandler | None:
|
||||||
"""(Hook) Find actual image loader."""
|
"""(Hook) Find actual image loader."""
|
||||||
msg = "StubImageFile subclass must implement _load"
|
pass
|
||||||
raise NotImplementedError(msg)
|
|
||||||
|
|
||||||
|
|
||||||
class Parser:
|
class Parser:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user