%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/PIL/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/PIL/__pycache__/PpmImagePlugin.cpython-312.pyc

�

��e_,��&�ddlmZddlmZmZddlmZddlmZddlm	Z
dZdd	d
dd	d
ddd
dd�
Zd�Z
Gd�dej�ZGd�dej�ZGd�dej�Zd�Zej&ej(ee
�ej*ej(e�ej,de�ej,de�ej.ej(gd��ej0ej(d�y)�)�annotations�)�Image�	ImageFile)�i16be)�o8)�o32les 	

�1�L�RGB�CMYK�P�RGBA)
�P1�P2�P3�P4�P5�P6sP0CMYKsPyPsPyRGBAsPyCMYKc�$�|dddk(xr|ddvS)Nrr�Ps0123456y�)�prefixs �4/usr/lib/python3/dist-packages/PIL/PpmImagePlugin.py�_acceptr-s!���!�A�;�$��;�6�!�9��#;�;�c�&�eZdZdZdZd�Zd�Zd�Zy)�PpmImageFile�PPMz
Pbmplus imagec��d}td�D]/}|jjd�}|r|tvr|S||z
}�1|S)Nr�r)�range�fp�read�b_whitespace)�self�magic�_�cs    r�_read_magiczPpmImageFile._read_magic9sO�����q��	�A������Q��A���\�)����
�Q�J�E�		�
�rc��d}t|�dkr�|jjd�}|snb|tvr|s�7nV|dk(r=|jjd�dvr	|jjd�dvr��z||z
}t|�dkr��|s
d}t	|��t|�dkDrd|j���}t	|��|S)Nr�
r�#s
z Reached EOF while reading headerzToken too long in file header: )�lenr#r$r%�
ValueError�decode)r&�tokenr)�msgs    r�_read_tokenzPpmImageFile._read_tokenCs������%�j�B�������Q��A����l�"�����d���g�g�l�l�1�o�W�4���g�g�l�l�1�o�W�4���Q�J�E��%�j�B���4�C��S�/�!�
��Z�"�_�3�E�L�L�N�3C�D�C��S�/�!��rc��|j�}	t|}|dvrd|_n|dvrd|_n|dvrd|_d}d}|d	vrd
}td�D]�}t
|j��}|dk(r|}�$|d
k(r|}	|dk(rd|_d}
nZ|x|_}
�E|dk(s�K|}d|cxkrdksnd}t|��|dkDr|dk(rd|_|d
k7s�~|dk(r|dk(rd}
��|dk7s��d}��|dk(r
dd
fn
|f}	f|_
|dd||	f|jj�|fg|_
y#t$rd}t|��wxYw)Nznot a PPM file)rrzimage/x-portable-bitmap)rrzimage/x-portable-graymap)rrzimage/x-portable-pixmap�raw)rrr�	ppm_plain�rrr
�1;I�iz1maxval must be greater than 0 and less than 65536�r�I��I;16B�ppm)r*�MODES�KeyError�SyntaxError�custom_mimetyper"�intr3�_moder/�_sizer#�tell�tile)r&�magic_number�moder2�maxval�decoder_name�ixr1�xsize�ysize�rawmode�argss            r�_openzPpmImageFile._open]s����'�'�)��	#���&�D�
�>�)�#<�D� �
�^�
+�#=�D� �
�^�
+�#<�D� ������0�0�&�L���(�	-�B���(�(�*�+�E��Q�w����q�����3�;�!$�D�J�#�G��+/�/�D�J���q�����6�)�E�)�M�C�$�S�/�)��C�<�D�C�K�!$�D�J��;�.����4�3�;�")���3��',��3	-�6#/�%�"7���A��g�v�=N���E�\��
�"�Q��5�%�$8�$�'�'�,�,�.�$�O�P��	��Y�	#�"�C��c�"�"�	#�s�	D(�(D?N)�__name__�
__module__�__qualname__�format�format_descriptionr*r3rQrrrrr5s��
�F�(����40Qrrc�6�eZdZdZd�Zd	d�Zd�Zd�Zd�Zd�Z	y)
�PpmPlainDecoderTc�T�|jjtj�S)N)�fdr$r�	SAFEBLOCK)r&s r�_read_blockzPpmPlainDecoder._read_block�s���w�w�|�|�I�/�/�0�0rc��|jd|�}|jd|�}||zdkDrt||�St||�S)N�
�
r)�find�min�max)r&�block�start�a�bs     r�_find_comment_endz!PpmPlainDecoder._find_comment_end�sC���J�J�u�e�$���J�J�u�e�$����E�A�I�s�1�a�y�4�3�q�!�9�4rc�0�|jr4|r2|j|�}|dk7r	||dzd}n|j�}|r�2d|_	|jd�}|dk(r	|S|j||�}|dk7r|d|||dzdz}n|d|}d|_	|S�O)N���rFTr-)�_comment_spansrgr\r`)r&rc�comment_end�
comment_starts    r�_ignore_commentsz PpmPlainDecoder._ignore_comments�s�������"�4�4�U�;���"�$�"�+��/�"3�4�E��!�,�,�.�E��$����!�J�J�t�,�M���"�����0�0��
�F�K��b� ��n�}�-��k�A�o�6G�0H�H���n�}�-��&*��#����rc���t�}|jj|jjz}t	|�|k7r|j�}|snl|j
|�}dj|j��}|D] }|dvs�dt|g�z}t|��||zd|}t	|�|k7r�tjdd�}|j|�S)z�
        This is a separate method because in the plain PBM format, all data tokens are
        exactly one byte, so the inter-token whitespace is optional.
        r)�0�1sInvalid token for this mode: %sNs01s�)
�	bytearray�staterMrNr.r\rm�join�split�bytesr/�	maketrans�	translate)r&�data�total_bytesrc�tokensr1r2�inverts        r�_decode_bitonalzPpmPlainDecoder._decode_bitonal�s���
�{���j�j�&�&����)9�)9�9���$�i�;�&��$�$�&�E����)�)�%�0�E��X�X�e�k�k�m�,�F��
*����(�<�u�e�W�~�M�C�$�S�/�)�
*��6�M�<�K�0�D��$�i�;�&������4���~�~�f�%�%rc��t�}d}|jdk(rdnd}|jdk(rdnd}tj|j�}|jj
|jjz|z|z}d}t|�|k7�r:|j�}	|	s|rtd�}	n	|S|j|	�}	|r||	z}	d}|	j�}
|	rG|	d	dj�s4|
j�}t|�|kDrd
|d|dzz}t|��|
D]�}t|�|kDrd
|d|dzz}t|��t|�}
|
|kDrd|
��}t|��t|
|z|z�}
||jdk(rt!|
�n
t#|
�z
}t|�|k(s��nt|�|k7r��:|S)Nr,r;�rr<r:F� ris Token too long found in data: %sz'Channel value too large for this mode: )rqrIr�getmodebandsrrrMrNr.r\rmrt�isspace�popr/rC�round�o32r)r&rJrx�max_len�out_byte_count�out_max�bandsry�
half_tokenrcrzr2r1�values              r�_decode_blockszPpmPlainDecoder._decode_blocks�s����{����"�i�i�3�.��A���9�9��+�%����"�"�4�9�9�-���j�j�&�&����)9�)9�9�E�A�N�R���
��$�i�;�&��$�$�&�E���%�d�O�E��<��9�)�)�%�0�E��"�U�*��"�
��[�[�]�F��U�2�3�Z�/�/�1�#�Z�Z�\�
��z�?�W�,�;�j��7�UV�;�>W�W��%�S�/�)��
���u�:��'�=��m��RS��@T�T�C�$�S�/�)��E�
���6�>�C�E�7�K�C�$�S�/�)��e�f�n�w�6�7���d�i�i�3�&6��E�
�B�u�I�E���t�9��+��
�3�$�i�;�&�J�rc��d|_|jdk(r|j�}d}n=|jd}|j	|�}|jdk(rdn|j}|jt
|�|�y)NFr
z1;8rir;�I;32�rir)rjrIr|rPr��
set_as_rawru)r&�bufferrxrOrJs     rr0zPpmPlainDecoder.decode
sq��#����9�9����'�'�)�D��G��Y�Y�r�]�F��&�&�v�.�D� $�	�	�S� 0�f�d�i�i�G�����d��W�-�rN)r)
rRrSrT�	_pulls_fdr\rgrmr|r�r0rrrrXrX�s'���I�1�5�
 �D&�2.�`
rrXc��eZdZdZd�Zy)�
PpmDecoderTc�x�t�}|jd}|dkrdnd}|jdk(rdnd}|jdk(rdnd}tj|j�}t|�|jj|jjz|z|zkr�|jj||z�}t|�||zkrn�t|�D]^}	|dk(r||	nt||	|z�}
t|t|
|z|z��}
||jdk(rt|
�n
t!|
�z
}�`t|�|jj|jjz|z|zkr��|jdk(rd	n|j}|j#t%|�|�y
)Nri�rr9r;r~r<r:r�r�)rqrPrIrr�r.rrrMrNrZr$r"�i16rar�r�rr�ru)r&r�rxrJ�
in_byte_countr�r�r��pixelsrfr�rOs            rr0zPpmDecoder.decodes����{�����2���#�c�\��q�
�"�i�i�3�.��A���9�9��+�%����"�"�4�9�9�-���$�i�$�*�*�*�*�T�Z�Z�-=�-=�=��E��V�V��W�W�\�\�-�%�"7�8�F��6�{�]�U�2�2���5�\�
F��!.�!�!3�F�1�I��V�Q��EV�9W���G�U�5�6�>�G�+C�%D�E���d�i�i�3�&6��E�
�B�u�I�E��
F��$�i�$�*�*�*�*�T�Z�Z�-=�-=�=��E��V�V�!�I�I��,�&�$�)�)������d��W�-�rN)rRrSrTr�r0rrrr�r�s���I�rr�c
��|jdk(rd\}}nY|jdk(rd\}}nD|jdk(rd\}}n/|jdvrd\}}nd	|j�d
�}t|��|j|d|jzz�|dk(r|jd
�n-|dk(r(|dk(r|jd
�n|jd�t	j
||dd|jzd|ddffg�y)Nr
)r8rr)rrr;)r=r)rr)rrzcannot write mode z as PPMs
%d %d
rs255
rs65535
r5)rrrr)rI�OSError�write�sizer�_save)�imr#�filenamerO�headr2s      rr�r�5s���	�w�w�#�~�$�
���	���C��"�
���	���C��&�
���	���O�	#�$�
���"�2�7�7�)�7�3���c�l���H�H�T�L�2�7�7�*�
*�+��u�}�
�����	
����c�>��H�H�X���H�H�Z� �
�O�O�B��e�V�b�g�g�%5�q�7�A�q�/�J�K�Lrr>r6)z.pbmz.pgmz.ppmz.pnmzimage/x-portable-anymapN)�
__future__r�rr�_binaryrr�rr	r�r%r?rr�	PyDecoderrXr�r��
register_openrU�
register_save�register_decoder�register_extensions�
register_mimerrr�<module>r�s�� #��!��!�
+������������	��"<�XQ�9�&�&�XQ�~@�i�)�)�@�F��$�$��<M�6����L�'�'��w�?�����L�'�'��/�����u�j�)�����{�O�4�����,�-�-�/O�P�����L�'�'�)B�Cr

Zerion Mini Shell 1.0