Your IP : 3.12.163.120


Current Path : /opt/alt/python312/lib64/python3.12/email/mime/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/email/mime/__pycache__/image.cpython-312.pyc

�

�Q�f����dZdgZddlmZddlmZGd�de�ZgZd�Zd�Z	e	d��Z
e	d	��Ze	d
��Ze	d��Z
e	d��Ze	d
��Ze	d��Ze	d��Ze	d��Ze	d��Ze	d��Ze	d��Ze	d��Zy)z/Class representing image/* type MIME documents.�	MIMEImage�)�encoders)�MIMENonMultipartc�6�eZdZdZdej
fdd�d�Zy)rz1Class for generating image/* type MIME documents.N)�policyc��|�t|�n|}|�td��tj|d|fd|i|��|j	|�||�y)a�Create an image/* type MIME document.

        _imagedata contains the bytes for the raw image data.  If the data
        type can be detected (jpeg, png, gif, tiff, rgb, pbm, pgm, ppm,
        rast, xbm, bmp, webp, and exr attempted), then the subtype will be
        automatically included in the Content-Type header. Otherwise, you can
        specify the specific image subtype via the _subtype parameter.

        _encoder is a function which will perform the actual encoding for
        transport of the image data.  It takes one argument, which is this
        Image instance.  It should use get_payload() and set_payload() to
        change the payload to the encoded form.  It should also add any
        Content-Transfer-Encoding or other headers to the message as
        necessary.  The default encoding is Base64.

        Any additional keyword arguments are passed to the base class
        constructor, which turns them into parameters on the Content-Type
        header.
        Nz"Could not guess image MIME subtype�imager)�_what�	TypeErrorr�__init__�set_payload)�self�
_imagedata�_subtype�_encoderr�_paramss      �7/opt/alt/python312/lib64/python3.12/email/mime/image.pyrzMIMEImage.__init__s_��*)1�(8�5��$�h�����@�A�A��!�!�$���	-�&�	-�$+�	-�����$����)�__name__�
__module__�__qualname__�__doc__r�
encode_base64r�rrrr
s��;�,0�"�0�0��<@�rc�6�tD]}||�x}s�|cSy�N)�_rules)�data�rule�ress   rr
r
2s%�����t�*��3���J��rc�0�tj|�|Sr)r�append)�rulefuncs rrr:s��
�M�M�(���Orc�&�|dddvry|dddk(ryy)z1JPEG data with JFIF or Exif markers; and raw JPEG��
)sJFIFsExif�jpegN�s���r��hs r�_jpegr+?s-��	��2�w�$�$��	
�2�A��%�	%��
&rc�(�|jd�ryy)Ns�PNG

�png��
startswithr)s r�_pngr0Hs���|�|�(�)��*rc��|dddvryy)zGIF ('87 and '89 variants)Nr%)sGIF87asGIF89a�gifrr)s r�_gifr3Ns��	��!�u�&�&��'rc��|dddvryy)z-TIFF (can be in Motorola or Intel byte order)N�)sMMsII�tiffrr)s r�_tiffr7Us��	��!�u����rc�(�|jd�ryy)zSGI image librarys��rgbNr.r)s r�_rgbr:\���	�|�|�K� ��!rc�f�t|�dk\r#|dtd�k(r|ddvr	|ddvryy	y	y	y	)
zPBM (portable bitmap)�r�P�s14r5� 	

�pbmN��len�ordr)s r�_pbmrEc�G���1�v��{�
�a�D�C��I��!�A�$�%�-�A�a�D�J�4F��5G�-��rc�f�t|�dk\r#|dtd�k(r|ddvr	|ddvryy	y	y	y	)
zPGM (portable graymap)r=rr>r?s25r5r@�pgmNrBr)s r�_pgmrIkrFrc�f�t|�dk\r#|dtd�k(r|ddvr	|ddvryy	y	y	y	)
zPPM (portable pixmap)r=rr>r?s36r5r@�ppmNrBr)s r�_ppmrLsrFrc�(�|jd�ryy)zSun raster filesY�j��rastNr.r)s r�_rastrO{s��	�|�|�'�(��)rc�(�|jd�ryy)zX bitmap (X10 or X11)s#define �xbmNr.r)s r�_xbmrR�r;rc�(�|jd�ryy)NsBM�bmpr.r)s r�_bmprU�s���|�|�E���rc�:�|jd�r
|dddk(ryyy)NsRIFF��sWEBP�webpr.r)s r�_webprZ�s&���|�|�G���1�R��G�!3��"4�rc�(�|jd�ryy)Nsv/1�exrr.r)s r�_exrr]�s���|�|�'�(��)rN)r�__all__�emailr�email.mime.nonmultipartrrrr
rr+r0r3r7r:rErIrLrOrRrUrZr]rrr�<module>ras:��
6��-���4�� ��B
����
��������
������������������������������������
����
���r

?>