mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
Removed handling of deprecated WebP features
This commit is contained in:
parent
c9cf688ee7
commit
cbd47d8609
|
@ -9,7 +9,6 @@ from typing import IO
|
||||||
import PIL
|
import PIL
|
||||||
|
|
||||||
from . import Image
|
from . import Image
|
||||||
from ._deprecate import deprecate
|
|
||||||
|
|
||||||
modules = {
|
modules = {
|
||||||
"pil": ("PIL._imaging", "PILLOW_VERSION"),
|
"pil": ("PIL._imaging", "PILLOW_VERSION"),
|
||||||
|
@ -120,7 +119,7 @@ def get_supported_codecs() -> list[str]:
|
||||||
return [f for f in codecs if check_codec(f)]
|
return [f for f in codecs if check_codec(f)]
|
||||||
|
|
||||||
|
|
||||||
features: dict[str, tuple[str, str | bool, str | None]] = {
|
features: dict[str, tuple[str, str, str | None]] = {
|
||||||
"raqm": ("PIL._imagingft", "HAVE_RAQM", "raqm_version"),
|
"raqm": ("PIL._imagingft", "HAVE_RAQM", "raqm_version"),
|
||||||
"fribidi": ("PIL._imagingft", "HAVE_FRIBIDI", "fribidi_version"),
|
"fribidi": ("PIL._imagingft", "HAVE_FRIBIDI", "fribidi_version"),
|
||||||
"harfbuzz": ("PIL._imagingft", "HAVE_HARFBUZZ", "harfbuzz_version"),
|
"harfbuzz": ("PIL._imagingft", "HAVE_HARFBUZZ", "harfbuzz_version"),
|
||||||
|
@ -146,12 +145,8 @@ def check_feature(feature: str) -> bool | None:
|
||||||
|
|
||||||
module, flag, ver = features[feature]
|
module, flag, ver = features[feature]
|
||||||
|
|
||||||
if isinstance(flag, bool):
|
|
||||||
deprecate(f'check_feature("{feature}")', 12)
|
|
||||||
try:
|
try:
|
||||||
imported_module = __import__(module, fromlist=["PIL"])
|
imported_module = __import__(module, fromlist=["PIL"])
|
||||||
if isinstance(flag, bool):
|
|
||||||
return flag
|
|
||||||
return getattr(imported_module, flag)
|
return getattr(imported_module, flag)
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
return None
|
return None
|
||||||
|
@ -181,17 +176,7 @@ def get_supported_features() -> list[str]:
|
||||||
"""
|
"""
|
||||||
:returns: A list of all supported features.
|
:returns: A list of all supported features.
|
||||||
"""
|
"""
|
||||||
supported_features = []
|
return [f for f in features if check_feature(f)]
|
||||||
for f, (module, flag, _) in features.items():
|
|
||||||
if flag is True:
|
|
||||||
for feature, (feature_module, _) in modules.items():
|
|
||||||
if feature_module == module:
|
|
||||||
if check_module(feature):
|
|
||||||
supported_features.append(f)
|
|
||||||
break
|
|
||||||
elif check_feature(f):
|
|
||||||
supported_features.append(f)
|
|
||||||
return supported_features
|
|
||||||
|
|
||||||
|
|
||||||
def check(feature: str) -> bool | None:
|
def check(feature: str) -> bool | None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user