Use relative import

This commit is contained in:
Andrew Murray 2024-08-13 19:07:01 +10:00
parent f3aec6dd38
commit c7e6289b36

View File

@ -7,9 +7,9 @@ import warnings
from typing import IO from typing import IO
import PIL import PIL
from PIL import _deprecate
from . import Image from . import Image
from ._deprecate import deprecate
modules = { modules = {
"pil": ("PIL._imaging", "PILLOW_VERSION"), "pil": ("PIL._imaging", "PILLOW_VERSION"),
@ -149,7 +149,7 @@ def check_feature(feature: str) -> bool | None:
try: try:
imported_module = __import__(module, fromlist=["PIL"]) imported_module = __import__(module, fromlist=["PIL"])
if isinstance(flag, bool): if isinstance(flag, bool):
_deprecate.deprecate(f'check_feature("{feature}")', 12) deprecate(f'check_feature("{feature}")', 12)
return flag return flag
return getattr(imported_module, flag) return getattr(imported_module, flag)
except ModuleNotFoundError: except ModuleNotFoundError: