9
9
import PIL
10
10
11
11
from . import Image
12
- from ._deprecate import deprecate
13
12
14
13
modules = {
15
14
"pil" : ("PIL._imaging" , "PILLOW_VERSION" ),
@@ -120,7 +119,7 @@ def get_supported_codecs() -> list[str]:
120
119
return [f for f in codecs if check_codec (f )]
121
120
122
121
123
- features : dict [str , tuple [str , str | bool , str | None ]] = {
122
+ features : dict [str , tuple [str , str , str | None ]] = {
124
123
"raqm" : ("PIL._imagingft" , "HAVE_RAQM" , "raqm_version" ),
125
124
"fribidi" : ("PIL._imagingft" , "HAVE_FRIBIDI" , "fribidi_version" ),
126
125
"harfbuzz" : ("PIL._imagingft" , "HAVE_HARFBUZZ" , "harfbuzz_version" ),
@@ -146,12 +145,8 @@ def check_feature(feature: str) -> bool | None:
146
145
147
146
module , flag , ver = features [feature ]
148
147
149
- if isinstance (flag , bool ):
150
- deprecate (f'check_feature("{ feature } ")' , 12 )
151
148
try :
152
149
imported_module = __import__ (module , fromlist = ["PIL" ])
153
- if isinstance (flag , bool ):
154
- return flag
155
150
return getattr (imported_module , flag )
156
151
except ModuleNotFoundError :
157
152
return None
@@ -181,17 +176,7 @@ def get_supported_features() -> list[str]:
181
176
"""
182
177
:returns: A list of all supported features.
183
178
"""
184
- supported_features = []
185
- for f , (module , flag , _ ) in features .items ():
186
- if flag is True :
187
- for feature , (feature_module , _ ) in modules .items ():
188
- if feature_module == module :
189
- if check_module (feature ):
190
- supported_features .append (f )
191
- break
192
- elif check_feature (f ):
193
- supported_features .append (f )
194
- return supported_features
179
+ return [f for f in features if check_feature (f )]
195
180
196
181
197
182
def check (feature : str ) -> bool | None :
0 commit comments