a :jg* @shUddlmZddlZddlZddlZddlZddlmZddlZddl m Z ddl m Z ddd d d d Z d ddddZd ddddZddddZdddddZd ddddZd ddd d!Zddd"d#Zd$d$d$d%d&d'd(d)d*d+ Zd,ed-<d d.dd/d0Zd ddd1d2Zddd3d4Zd d.dd5d6Zd ddd7d8Zddd9d:ZdAdd?d@ZdS)B) annotationsN)IO)Image) deprecate) PIL._imagingZPILLOW_VERSION)zPIL._tkinter_finderZ tk_version)PIL._imagingftZfreetype2_version)zPIL._imagingcmsZlittlecms_version) PIL._webpZwebpdecoder_version)piltkinter freetype2 littlecms2webpstrbool)featurereturnc Cs|tvrd|}t|t|\}}zt|WdStyHYdStyz}ztt|WYd}~dSd}~00dS)z Checks if a module is available. :param feature: The module to check for. :returns: ``True`` if available, ``False`` otherwise. :raises ValueError: If the module is not defined in this version of Pillow. zUnknown module TFN)modules ValueError __import__ModuleNotFoundError ImportErrorwarningswarnr)rmsgmoduleverexr6/usr/local/lib/python3.9/site-packages/PIL/features.py check_modules   r z str | NonecCs,t|s dSt|\}}tt||gd|S)z :param feature: The module to check for. :returns: The loaded version number as a string, or ``None`` if unknown or not available. :raises ValueError: If the module is not defined in this version of Pillow. Nfromlist)r rgetattrr)rrrrrrversion_module/s r$z list[str])rcCsddtDS)z4 :returns: A list of all supported modules. cSsg|]}t|r|qSr)r .0frrr Bz)get_supported_modules..)rrrrrget_supported_modules>sr*)ZjpegZjpeglib)Zjpeg2kZjp2klib)zipzlib)libtiffr-)jpgjpg_2000r,r-cCs:|tvrd|}t|t|\}}|dttjvS)z Checks if a codec is available. :param feature: The codec to check for. :returns: ``True`` if available, ``False`` otherwise. :raises ValueError: If the codec is not defined in this version of Pillow. zUnknown codec _encoder)codecsrdirrcore)rrcodeclibrrr check_codecMs   r6cCsNt|s dSt|\}}ttj|d}|dkrJ|ddddS|S)a :param feature: The codec to check for. :returns: The version number as a string, or ``None`` if not available. Checked at compile time for ``jpg``, run-time otherwise. :raises ValueError: If the codec is not defined in this version of Pillow. N_versionr- rzVersion r)r6r1r#rr3split)rr4r5versionrrr version_codec^s r;cCsddtDS)z3 :returns: A list of all supported codecs. cSsg|]}t|r|qSr)r6r%rrrr(wr)z(get_supported_codecs..)r1rrrrget_supported_codecsssr<)r TN)rZ HAVE_RAQMZ raqm_version)rZ HAVE_FRIBIDIZfribidi_version)rZ HAVE_HARFBUZZZharfbuzz_version)rZHAVE_LIBJPEGTURBOlibjpeg_turbo_version)rZHAVE_LIBIMAGEQUANTZimagequant_version)rZHAVE_XCBN) Z webp_animZwebp_muxZ transp_webpraqmfribidiharfbuzz libjpeg_turbo libimagequantxcbz-dict[str, tuple[str, str | bool, str | None]]featuresz bool | Nonec Cs|tvrd|}t|t|\}}}t|trDtd|ddz*t|dgd}t|trd|WSt||WStyYdSty}zt t |WYd}~dSd}~00dS)z Checks if a feature is available. :param feature: The feature to check for. :returns: ``True`` if available, ``False`` if unavailable, ``None`` if unknown. :raises ValueError: If the feature is not defined in this version of Pillow. zUnknown feature zcheck_feature("z") PILr!N) rDr isinstancerrrr#rrrrr)rrrflagrZimported_modulerrrr check_features      rIcCs:t|s dSt|\}}}|dur&dStt||gd|S)z :param feature: The feature to check for. :returns: The version number as a string, or ``None`` if not available. :raises ValueError: If the feature is not defined in this version of Pillow. Nr!)rIrDr#r)rrrHrrrrversion_features rJcCspg}tD]^\}\}}}|durXtD]*\}\}}||kr*t|rP||qjq*q t|r ||q |S)z5 :returns: A list of all supported features. T)rDitemsrr appendrI)Zsupported_featuresr'rrH_rZfeature_modulerrrget_supported_featuress  rNcCsJ|tvrt|S|tvr t|S|tvr0t|Stjd|ddddS)z :param feature: A module, codec, or feature name. :returns: ``True`` if the module, codec, or feature is available, ``False`` or ``None`` otherwise. zUnknown feature 'z'.) stacklevelF)rr r1r6rDrIrrrrrrchecksrRcCs4|tvrt|S|tvr t|S|tvr0t|SdS)z :param feature: The module, codec, or feature to check for. :returns: The version number as a string, or ``None`` if unknown or not available. N)rr$r1r;rDrJrQrrrr:sr:cCs"t}|t|t|S)zJ :returns: A list of all supported modules, features, and codecs. )r*extendrNr<)retrrr get_supporteds  rUTzIO[str] | NoneNone)outsupported_formatsrc Cs|durtj}ttd|dtdtj|dtj}td|d |d|ddD]}td| |dqftd|dtd tj pd |dtj tj krtd tj |dtd tj |dtd|dtd t jtj|dtdt jtjj|dtd|ddD]\}}t|r(d}|dkrltd}|durld|}|dur~t|}|dur|dv}|dkrtdd|dDdk}|rdnd} |dkrdD],} t| } | dur|d| d| 7}qtd|d | ||dntd|d!|dntd"|d#|dq0td|d|rtt} tjD]\} }| || qbttjD]}|}|tjvr|dtj|}t||d|| vrtd$d t| ||dg}|tj!vr|d%|tj"vr|d&|tj#vr,|d'|tj$vrB|d(|tj%vrX|d)td*d ||dtd|dqdS)+a  Prints information about this installation of Pillow. This function can be called with ``python3 -m PIL``. It can also be called with ``python3 -m PIL.report`` or ``python3 -m PIL --report`` to have "supported_formats" set to ``False``, omitting the list of all supported image file formats. :param out: The output stream to print to. Defaults to ``sys.stdout`` if ``None``. :param supported_formats: If ``True``, a list of all supported image file formats will be printed. NzD--------------------------------------------------------------------)filezPillow zPython rrz zPython executable is unknownz%Environment Python files loaded from z System Python files loaded from z"Python Pillow modules loaded from z"Binary Pillow modules loaded from ) )r zPIL CORE)r ZTKINTER)r Z FREETYPE2)r Z LITTLECMS2)rZWEBP)r.ZJPEG)r/zOPENJPEG (JPEG2000))r,zZLIB (PNG/ZIP))r-ZLIBTIFF)r>zRAQM (Bidirectional Text))rBz#LIBIMAGEQUANT (Quantization method))rCzXCB (X protocol)r.rAzlibjpeg-turbo )r r.r css|]}t|VqdS)N)int)r&xrrr 5r)zpilinfo...)rOz compiled forZloadedr>)r?r@z,  z---z support ok,z support okz***zsupport not installedzExtensions: {}opensaveZsave_alldecodeencodez Features: {})&sysstdoutrinitprintrF __version__r: splitlinesstrip executableprefix base_prefixospathdirname__file__r3rRrJtupler9 collections defaultdictlistZ EXTENSIONrKrLsortedZIDMIMEformatjoinZOPENZSAVEZSAVE_ALLZDECODERSZENCODERS)rWrXZpy_version_lines py_versionnamervr=Zversion_statictr'Zv2 extensionsextilinerDrrrpilinfos                             r)NT) __future__rrtrorertypingrrFrZ _deprecaterrr r$r*r1r6r;r<rD__annotations__rIrJrNrRr:rUrrrrrsT