mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 13:14:27 +03:00
use _util.DeferredError.new everywhere
This commit is contained in:
parent
6bcf807fe2
commit
90d5552800
|
@ -66,7 +66,7 @@ def test_deferred_error():
|
|||
# Arrange
|
||||
|
||||
# Act
|
||||
thing = _util.DeferredError(ValueError("Some error text"))
|
||||
thing = _util.DeferredError.new(ValueError("Some error text"))
|
||||
|
||||
# Assert
|
||||
with pytest.raises(ValueError):
|
||||
|
|
|
@ -144,9 +144,7 @@ exclude = [
|
|||
'^src/PIL/DdsImagePlugin.py$',
|
||||
'^src/PIL/FpxImagePlugin.py$',
|
||||
'^src/PIL/Image.py$',
|
||||
'^src/PIL/ImageCms.py$',
|
||||
'^src/PIL/ImageFile.py$',
|
||||
'^src/PIL/ImageFont.py$',
|
||||
'^src/PIL/ImageMath.py$',
|
||||
'^src/PIL/ImageMorph.py$',
|
||||
'^src/PIL/ImageQt.py$',
|
||||
|
|
|
@ -92,7 +92,7 @@ try:
|
|||
raise ImportError(msg)
|
||||
|
||||
except ImportError as v:
|
||||
core = DeferredError(ImportError("The _imaging C module is not installed."))
|
||||
core = DeferredError.new(ImportError("The _imaging C module is not installed."))
|
||||
# Explanations for ways that we know we might have an import error
|
||||
if str(v).startswith("Module use of python"):
|
||||
# The _imaging C module is present, but not compiled for
|
||||
|
|
|
@ -28,7 +28,7 @@ except ImportError as ex:
|
|||
# anything in core.
|
||||
from ._util import DeferredError
|
||||
|
||||
_imagingcms = DeferredError(ex)
|
||||
_imagingcms = DeferredError.new(ex)
|
||||
|
||||
DESCRIPTION = """
|
||||
pyCMS
|
||||
|
|
|
@ -34,7 +34,7 @@ import warnings
|
|||
from enum import IntEnum
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
from typing import IO
|
||||
from typing import BinaryIO
|
||||
|
||||
from . import Image
|
||||
from ._util import is_directory, is_path
|
||||
|
@ -53,7 +53,7 @@ try:
|
|||
except ImportError as ex:
|
||||
from ._util import DeferredError
|
||||
|
||||
core = DeferredError(ex)
|
||||
core = DeferredError.new(ex)
|
||||
|
||||
|
||||
def _string_length_check(text):
|
||||
|
@ -191,7 +191,7 @@ class FreeTypeFont:
|
|||
|
||||
def __init__(
|
||||
self,
|
||||
font: bytes | str | Path | IO | None = None,
|
||||
font: bytes | str | Path | BinaryIO | None = None,
|
||||
size: float = 10,
|
||||
index: int = 0,
|
||||
encoding: str = "",
|
||||
|
|
|
@ -43,7 +43,7 @@ except ImportError as ex:
|
|||
# anything in core.
|
||||
from ._util import DeferredError
|
||||
|
||||
FFI = ffi = DeferredError(ex)
|
||||
FFI = ffi = DeferredError.new(ex)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
5
src/PIL/_imagingcms.pyi
Normal file
5
src/PIL/_imagingcms.pyi
Normal file
|
@ -0,0 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
def __getattr__(name: str) -> Any: ...
|
5
src/PIL/_imagingft.pyi
Normal file
5
src/PIL/_imagingft.pyi
Normal file
|
@ -0,0 +1,5 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
def __getattr__(name: str) -> Any: ...
|
Loading…
Reference in New Issue
Block a user