99import PIL
1010
1111from . import Image
12- from ._deprecate import deprecate
1312
1413modules = {
1514 "pil" : ("PIL._imaging" , "PILLOW_VERSION" ),
@@ -120,7 +119,7 @@ def get_supported_codecs() -> list[str]:
120119 return [f for f in codecs if check_codec (f )]
121120
122121
123- features : dict [str , tuple [str , str | bool , str | None ]] = {
122+ features : dict [str , tuple [str , str , str | None ]] = {
124123 "raqm" : ("PIL._imagingft" , "HAVE_RAQM" , "raqm_version" ),
125124 "fribidi" : ("PIL._imagingft" , "HAVE_FRIBIDI" , "fribidi_version" ),
126125 "harfbuzz" : ("PIL._imagingft" , "HAVE_HARFBUZZ" , "harfbuzz_version" ),
@@ -146,12 +145,8 @@ def check_feature(feature: str) -> bool | None:
146145
147146 module , flag , ver = features [feature ]
148147
149- if isinstance (flag , bool ):
150- deprecate (f'check_feature("{ feature } ")' , 12 )
151148 try :
152149 imported_module = __import__ (module , fromlist = ["PIL" ])
153- if isinstance (flag , bool ):
154- return flag
155150 return getattr (imported_module , flag )
156151 except ModuleNotFoundError :
157152 return None
@@ -181,17 +176,7 @@ def get_supported_features() -> list[str]:
181176 """
182177 :returns: A list of all supported features.
183178 """
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 )]
195180
196181
197182def check (feature : str ) -> bool | None :
0 commit comments