mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +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
|
# Arrange
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
thing = _util.DeferredError(ValueError("Some error text"))
|
thing = _util.DeferredError.new(ValueError("Some error text"))
|
||||||
|
|
||||||
# Assert
|
# Assert
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
|
|
|
@ -144,9 +144,7 @@ exclude = [
|
||||||
'^src/PIL/DdsImagePlugin.py$',
|
'^src/PIL/DdsImagePlugin.py$',
|
||||||
'^src/PIL/FpxImagePlugin.py$',
|
'^src/PIL/FpxImagePlugin.py$',
|
||||||
'^src/PIL/Image.py$',
|
'^src/PIL/Image.py$',
|
||||||
'^src/PIL/ImageCms.py$',
|
|
||||||
'^src/PIL/ImageFile.py$',
|
'^src/PIL/ImageFile.py$',
|
||||||
'^src/PIL/ImageFont.py$',
|
|
||||||
'^src/PIL/ImageMath.py$',
|
'^src/PIL/ImageMath.py$',
|
||||||
'^src/PIL/ImageMorph.py$',
|
'^src/PIL/ImageMorph.py$',
|
||||||
'^src/PIL/ImageQt.py$',
|
'^src/PIL/ImageQt.py$',
|
||||||
|
|
|
@ -92,7 +92,7 @@ try:
|
||||||
raise ImportError(msg)
|
raise ImportError(msg)
|
||||||
|
|
||||||
except ImportError as v:
|
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
|
# Explanations for ways that we know we might have an import error
|
||||||
if str(v).startswith("Module use of python"):
|
if str(v).startswith("Module use of python"):
|
||||||
# The _imaging C module is present, but not compiled for
|
# The _imaging C module is present, but not compiled for
|
||||||
|
|
|
@ -28,7 +28,7 @@ except ImportError as ex:
|
||||||
# anything in core.
|
# anything in core.
|
||||||
from ._util import DeferredError
|
from ._util import DeferredError
|
||||||
|
|
||||||
_imagingcms = DeferredError(ex)
|
_imagingcms = DeferredError.new(ex)
|
||||||
|
|
||||||
DESCRIPTION = """
|
DESCRIPTION = """
|
||||||
pyCMS
|
pyCMS
|
||||||
|
|
|
@ -34,7 +34,7 @@ import warnings
|
||||||
from enum import IntEnum
|
from enum import IntEnum
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import IO
|
from typing import BinaryIO
|
||||||
|
|
||||||
from . import Image
|
from . import Image
|
||||||
from ._util import is_directory, is_path
|
from ._util import is_directory, is_path
|
||||||
|
@ -53,7 +53,7 @@ try:
|
||||||
except ImportError as ex:
|
except ImportError as ex:
|
||||||
from ._util import DeferredError
|
from ._util import DeferredError
|
||||||
|
|
||||||
core = DeferredError(ex)
|
core = DeferredError.new(ex)
|
||||||
|
|
||||||
|
|
||||||
def _string_length_check(text):
|
def _string_length_check(text):
|
||||||
|
@ -191,7 +191,7 @@ class FreeTypeFont:
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
font: bytes | str | Path | IO | None = None,
|
font: bytes | str | Path | BinaryIO | None = None,
|
||||||
size: float = 10,
|
size: float = 10,
|
||||||
index: int = 0,
|
index: int = 0,
|
||||||
encoding: str = "",
|
encoding: str = "",
|
||||||
|
|
|
@ -43,7 +43,7 @@ except ImportError as ex:
|
||||||
# anything in core.
|
# anything in core.
|
||||||
from ._util import DeferredError
|
from ._util import DeferredError
|
||||||
|
|
||||||
FFI = ffi = DeferredError(ex)
|
FFI = ffi = DeferredError.new(ex)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
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