File: //home/arjun/projects/env/lib/python3.10/site-packages/PIL/__pycache__/features.cpython-310.pyc
o
we�% �
@ s� d dl Z d dlZd dlZd dlZd dlZddlmZ dddddd �Zd
d� Zdd
� Z dd� Z
ddddd�Zdd� Zdd� Z
dd� Zdddddd d!d"d#d$� Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� Zd/d0� Zd4d2d3�ZdS )5� N� )�Image)�PIL._imaging�PILLOW_VERSION)zPIL._tkinter_finder�
tk_version)�PIL._imagingft�freetype2_version)zPIL._imagingcms�littlecms_version)� PIL._webp�webpdecoder_version)�pil�tkinter� freetype2�
littlecms2�webpc
C s| | t vr
d| � �}t|��t | \}}zt|� W dS ty$ Y dS ty= } zt�t|�� W Y d}~dS d}~ww )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�ImportError�warnings�warn�str)�feature�msg�module�ver�ex� r �E/home/arjun/projects/env/lib/python3.10/site-packages/PIL/features.py�check_module s
��r c C s8 t | �sdS t| \}}|du rdS 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.
N��fromlist)r r �getattrr )r r r r r r �version_module+ s r$ c C � dd� t D �S )z4
:returns: A list of all supported modules.
c S � g | ]}t |�r|�qS r )r ��.0�fr r r �
<listcomp>A � z)get_supported_modules.<locals>.<listcomp>)r r r r r �get_supported_modules= � r, )�jpeg�jpeglib)�jpeg2k�jp2klib)�zip�zlib)�libtiffr4 )�jpg�jpg_2000r3 r4 c C s8 | t vr
d| � �}t|��t | \}}|d ttj�v S )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)�codecsr �dirr �core)r r �codec�libr r r �check_codecL s
r= c C sL t | �sdS t| \}}ttj|d �}| dkr$|�d�d �d�d S |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�_versionr4 �
r zVersion r )r= r8 r# r r: �split)r r; r<