� B�g f����ddlmZddlZddlZddlZddlZddlZddlZddlm Z m Z m Z m Z m Z ddlmZddlmZddlmZe rddlmZd Zd Zd Z d d dddd�Z d?d�Zd@d�ZdAd�ZGd�de ��ZGd�dej��ZGd �d!��ZGd"�d#e��Z Gd$�d%��Z!dBdCd.�Z" dDdEd3�Z#dFd6�Z$Gd7�d8��Z%Gd9�d:��Z&Gd;�d<e&��Z'Gd=�d>e&��Z(dS)G�)� annotationsN)�IO� TYPE_CHECKING�Any� NamedTuple�cast�)�Image)� deprecate)�is_path)�StrOrBytesPathiiFzimage buffer overrun errorzdecoding errorz unknown errorzbad configurationzout of memory error)��������������������i�����error�int�encoder�bool�return�OSErrorc��� tj�|��}n*#t$rt�|��}YnwxYw|s |rdnd�d|��}|d|rdnd�d�z }t |��S)Nr�decoderz error z when �writing�readingz image file)r �core�getcodecstatus�AttributeError�ERRORS�getr)rr�msgs �]/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/PIL/ImageFile.py� _get_oserrorr#Hs��� ��j�'�'��.�.���� � � � ��j�j������� ���� �E�%�4���9�D�D�U�D�D��� D��7�I�I�i� D� D� D�D�C� �3�<�<�s�"�$A �A c�H�tddd���t|d����)N� raise_oserror� z�It is only useful for translating error codes returned by a codec's decode() method, which ImageFile already does automatically.)�actionF�r)r r#)rs r"r%r%Ss:�� �� �G����� �u�e� ,� ,� ,�,��t�_Tilec��|dS)N��)r*s r"� _tilesortr/]s �� �Q�4�Kr)c�@�eZdZUded<ded<dZded<dZd ed <dS) r+�str� codec_name� tuple[int, int, int, int] | None�extentsrr�offsetNztuple[Any, ...] | str | None�args)�__name__� __module__� __qualname__�__annotations__r5r6r.r)r"r+r+bsE��������O�O�O�-�-�-�-��F�O�O�O�O�)-�D�-�-�-�-�-�-r)c�l��eZdZdZ dd�fd � Zdd �Zdd �Zd�fd� Zdd�Zdd�Z dd�Z dd�Z dd�Z �xZ S) � ImageFilez*Base class for image file format handlers.N�fp�StrOrBytesPath | IO[bytes]�filename�str | bytes | Noner�Nonec� ��t�����d|_d|_g|_ d|_d|_t|_t|��r6t|d��|_ tj |��|_d|_n7t!t"t$|��|_ |�|nd|_d|_ |���n@#t(t*t,t.t0jf$r}t5|��|�d}~wwxYw|jr"|jddks|jddkrd}t5|���dS#t:$r"|jr|j ����wxYw) Nrr r.�rbT�Fznot identified by this driver)�super�__init__� _min_frame�custom_mimetype�tile�readonly� decoderconfig�MAXBLOCK�decodermaxblockr �openr=�os�fspathr?� _exclusive_fprr�bytes�_open� IndexError� TypeError�KeyError�EOFError�structr� SyntaxError�mode�size� BaseException�close)�selfr=r?�vr!� __class__s �r"rFzImageFile.__init__qs���� �����������+/���!#�� �*��� �.0���'��� �2�;�;� '��2�t�n�n�D�G��I�b�M�M�D�M�!%�D� � ��2�e�9�b�)�)�D�G�(0�(<�H�H�"�D�M�!&�D� � � ,�� � � � � � ������� � � ,� ,� ,�"�!�n�n�!�+����� ,�����9� '�� �!� �� 1� 1�T�Y�q�\�Q�5F�5F�5��!�#�&�&�&�6G�5F��� � � ��!� ��� � ���� �  ���s*�C%�$E!�%(D"� D�D"�"=E!�!,F c��dS�Nr.�r^s r"rSzImageFile._open���� �r)� str | Nonec��|jr|jS|j�6tj�|j�����SdSrb)rH�formatr �MIMEr �upperrcs r"�get_format_mimetypezImageFile.get_format_mimetype�sE�� � � (��'� '� �;� "��:�>�>�$�+�"3�"3�"5�"5�6�6� 6��tr)�state� list[Any]c�X��g|_t���|��dSrb)rIrE� __setstate__)r^rkr`s �r"rnzImageFile.__setstate__�s(����� � �����U�#�#�#�#�#r)c�T�|jr|j���d|_dS)zCheck file integrityN)rQr=r]rcs r"�verifyzImageFile.verify�s)�� � � � �G�M�M�O�O�O�����r)�Image.core.PixelAccess | Nonec�� �|js|j�d}t|���tj�|��}|js|Sd|_|jot|j��dk}|ottd�� }d}t|d��r |j }d}n |j j }t|d��r |j }d}n |j j}|�r�|jd\}}} } t| t ��r| ddf} |d k�rgt| t"���rQt| ��d k�r=| d|jk�r+| dtjv�r ddl} t+|j��5} | �| ���d| j� ��|_ddd��n #1swxYwY| |jd| dzz|j���krd }t|���tj�|j|j|| | ��|_d}|jr d|j_n$#t<tt>f$r d|_YnwxYw|� ��d } |j�s�|j�!tD���tG|dd��}d�tIj%|jd���D��|_|jD�]f\}}} } || ��tj&|j|| |j'��} |�(|j|��|j)r6|�*|j ��|�+d��d} n�|} ||j,��}n<#tZt\j/f$r#}t`rYd}~nud}t|��|�d}~wwxYw|s*t`rnQdt|���d�}t|���||z}|�+|��\}} |dkrn ||d�}��|�1����O#|�1��wxYwg|_||_2|�3��|j4r |j5r|j �6��d|_ |jst`s| dkrto| d����tj�|��S)z"Load image data based on tile listNzcannot load this imager �pypy_version_infor� load_readF� load_seek�raw�)�accesszbuffer is not large enoughr��key� tile_prefixr)c�>�g|]\}}t|��d��S)r)�list)�.0�_�tiless r"� <listcomp>z"ImageFile.load.<locals>.<listcomp>s6������A�u��U� � �B����r)c�0�|d|d|dfS)Nrr rwr.)rIs r"�<lambda>z ImageFile.load.<locals>.<lambda>s��T�!�W�d�1�g�t�A�w�,G�r)Tzimage file is truncatedzimage file is truncated (z bytes not processed)r()8rI�_imrr �load�mapr?�len�hasattr�sysrtr=�readru�seek� isinstancer1�tuplerZ� _MAPMODES�mmaprN�fileno� ACCESS_READr[r� map_buffer�im�palette�dirtyr� ImportError� load_prepare�sortr/�getattr� itertools�groupby� _getdecoderrK�setimage�pulls_fd�setfd�decoderMrTrXr�LOAD_TRUNCATED_IMAGES�cleanuprJ�load_endrQ�!_close_exclusive_fp_after_loadingr]r#)r^r!�pixel�use_mmaprJr�r�� decoder_namer4r5r6r�r=�err_code�prefixr�b�s�e�ns r"r�zImageFile.load�s|���y� �T�X�-�*�C��#�,�,� �� � � ��&�&���y� ��L�%)����=�8�S���^�^�q�%8���E�G�C�1D�$E�$E� E���� �4�� %� %� ��>�D��H�H��7�<�D� �4�� %� %� ��>�D��H�H��7�<�D� � $�26�)�A�,� /�L�'�6�4��$��$�$� $��a��|����%�%��t�U�+�+�&���I�I��N�N���G�t�y�(�(���G�u��.�.�$��K�K�K��d�m�,�,�V��#'�9�9�R�Y�Y�[�[�!�D�DT�9�#U�#U���V�V�V�V�V�V�V�V�V�V�V����V�V�V�V��� �!� �t�A�w� 6�6�������H�H�:��%�c�l�l�*�#�j�3�3���$�)�\�6�4���D�G� !�H��|�/�-.�� �*���&���=�$�$�$�#�D�H�H�H�$���� ���������x�6 &� �I�N�N�y�N� )� )� )��T�=�#�6�6�F��� )� 1��I�G�G�!�!����D�I� 8<�y�( &�( &�3� �g�v�t���V� � � ��+��I�|�T�4�3E����#&��$�$�T�W�g�6�6�6��'�&�� � �d�g�.�.�.�#*�>�>�#�#6�#6�q�#9���"��&�>�$(�D��)=�$>�$>����$.�� �#=�>�>�>�#8�!>�$)�E�E�E�E�*C�C�*1�#�,�,�A�$=����� >����$%�7�#8�!7�$)�)J�,/��F�F�)J�)J�)J�%(�+2�#�,�,�$6� !�A��A�*1�.�.��*;�*;�K�A�x� �1�u�u� %� !�!�"�"��A�3&�8�O�O�%�%�%�%��G�O�O�%�%�%�%������ � �� � � � ���� � � �$�"H� � �G�M�M�O�O�O�����x� 8� 5� 8�(�Q�,�,��x��7�7�7� 7��{����%�%�%su�I �45F5�) I �5F9�9I �<F9�=BI � I.�-I.�&AQ�N�Q�O �)O�0Q�5O�O � AQ�Qc���|j�/tj�|j|j��|_|jdkr!tj�|��dSdS)N�P)r�r r�newrZr[r�r�rcs r"r�zImageFile.load_prepareCsV�� �8� ��j�n�n�T�Y�� �:�:�D�G� �9�� � � �K� � �T� "� "� "� "� "� � r)c��dSrbr.rcs r"r�zImageFile.load_endK��� �r)�framerrc���||jks3t|d��r|j�-|t|d��|jzkrd}t |���|���|kS)N� _n_frames�n_framesz attempt to seek outside sequence)rGr�r�r�rW�tell)r^r�r!s r"� _seek_checkzImageFile._seek_checkWso�� �D�O� #� #��T�;�/�/� $�59�N�4J��W�T�:�6�6���H�H�H�5�C��3�-�-� ��y�y�{�{�e�#�#r)rb)r=r>r?r@rrA�rrA)rre)rkrlrrA�rrq)r�rrr)r7r8r9�__doc__rFrSrjrnrpr�r�r�r�� __classcell__)r`s@r"r<r<ns��������4�4�NR�0�0�0�0�0�0�0�d � � � �����$�$�$�$�$�$�����G&�G&�G&�G&�R#�#�#�#� � � � � $� $� $� $� $� $� $� $r)r<c�8�eZdZd d�Zejd d���ZdS) � StubHandlerr�� StubImageFilerrAc��dSrbr.�r^r�s r"rNzStubHandler.openhrdr)� Image.Imagec��dSrbr.r�s r"r�zStubHandler.loadkr�r)N)r�r�rrA)r�r�rr�)r7r8r9rN�abc�abstractmethodr�r.r)r"r�r�gsL������ � � � � �� � � ��� � � r)r�c�*�eZdZdZd d�Zd d�Zd d�Zd S) r�z� Base class for stub image loaders. A stub loader is an image loader that can identify files of a certain format, but relies on external code to load the file. rrAc�$�d}t|���)Nz+StubImageFile subclass must implement _open��NotImplementedError�r^r!s r"rSzStubImageFile._openxs��;��!�#�&�&�&r)rqc���|���}|�d|j�d�}t|���|�|��}|�J�|j|_|j|_|���S)Nzcannot find loader for this z file)�_loadrgrr�r`�__dict__)r^�loaderr!�images r"r�zStubImageFile.load|so�������� �>�C���C�C�C�C��#�,�,� �� � �D�!�!��� � � �������� ��z�z�|�|�r)�StubHandler | Nonec�$�d}t|���)z (Hook) Find actual image loader.z+StubImageFile subclass must implement _loadr�r�s r"r�zStubImageFile._load�s��;��!�#�&�&�&r)Nr�r�)rr�)r7r8r9r�rSr�r�r.r)r"r�r�psZ��������'�'�'�'� � � � �'�'�'�'�'�'r)r�c�r�eZdZUdZdZdZded<dZded<dZded<d Z d Z dd �Z dd�Z dd�Z dd�Zdd�ZdS)�Parserzj Incremental image parser. This class implements the standard feed/close consumer interface. NzImage.Image | Noner�z bytes | None�dataz,Image.core.ImagingDecoder | PyDecoder | NonerrrrAc�(�|j� Jd���dS)z� (Consumer) Reset the parser. Note that you can only call this method immediately after you've created a parser; parser instances cannot be reused. Nzcannot reuse parsers)r�rcs r"�resetz Parser.reset�s!�� �y� � �"8� � � � � r)rRc���|jrdS|j�||_n|j|z|_|jr�|jdkr^t t |j��|j��}|j|d�|_|j|z |_|jdks|jsdS|j�|j��\}}|dkr.d|_d|_|dkrd|_t|d����dS|j|d�|_dS|jrdS tj |j��5}tj |��}ddd��n #1swxYwYt|d��pt|d��}|st |j��dkrd|_n�|���|jd\}}} } g|_tj|j|| |j��|_|j�|j|��| |_|jt |j��kr |j|jd�|_d|_||_dS#t*$rYdSwxYw)z� (Consumer) Feed data to the parser. :param data: A string buffer. :exception OSError: If the parser failed to parse the image file. Nrr Fr(rurt)�finishedr�rr5�minr�r�r�r#�io�BytesIOr rNr�rIr�r�rZrKr�r�r) r^r��skipr�r�r=r��flag�d�o�as r"�feedz Parser.feed�s��� �=� � �F� �9� ��D�I�I�� �D�(�D�I� �<�8 ��{�Q����3�t�y�>�>�4�;�7�7�� �I�d�e�e�,�� �"�k�D�0�� ��;��?�?�$�)�?��F��<�&�&�t�y�1�1�D�A�q��1�u�u� �� � !�� ��q�5�5�!%�D�J�&�q�%�8�8�8�8��F�� �!�"�"� �D�I�I�I� �Z� � �D� ��Z�� �*�*�(�b���B���B�(�(�(�(�(�(�(�(�(�(�(����(�(�(�(� �r�;�/�/�K�7�2�{�3K�3K���(�3�r�w�<�<�1�,�,�"&�D�K�K��O�O�%�%�%�!#����J�A�q�!�Q� �B�G�#(�#4�R�W�a��B�DT�#U�#U�D�L��L�)�)�"�%��3�3�3�#$�D�K��{�c�$�)�n�n�4�4�$(�I�d�k�m�m�$<�� �&'�� ��� � � ��+� � � ���� ���s6�I�'E�< I�E � I�E �I� I#�"I#c��|Srbr.rcs r"� __enter__zParser.__enter__�s��� r)r6�objectc�.�|���dSrb)r]�r^r6s r"�__exit__zParser.__exit__�s�� � � � � � � � r)r�c���|jr;|�d��dx|_|_|jsd}t |���|jsd}t |���|jr�t j|j��5} tj |��|_|j� ��n#|j� ��wxYw ddd��n #1swxYwY|jS)a (Consumer) Close the stream. :returns: An image object. :exception OSError: If the parser failed to parse the image file either because it cannot be identified or cannot be decoded. r)Nzimage was incompletezcannot parse this image) rr�r�r�rr�r�r�r rNr�)r^r!r=s r"r]z Parser.close�s�� �<� #� �I�I�c�N�N�N�'+� +�D�I�� ��=� #�,���c�l�l�"��z� �+�C��#�,�,� � �9� &���D�I�&�&� &�"�&�!&��B���D�J��J�O�O�%�%�%�%��D�J�O�O�%�%�%�%����%�  &� &� &� &� &� &� &� &� &� &� &���� &� &� &� &� �z�s*�;C�=B0�C�0C � C�C�"Cr�)r�rRrrA)rr�)r6r�rrA)rr�)r7r8r9r�� incrementalr�r:r�rr5r�r�r�r�r�r]r.r)r"r�r��s���������� �K� $�E�$�$�$�$��D�����<@�G�@�@�@�@� �F��H�9�9�9�9�J �J �J �J �X�������������r)r�r�r�r=� IO[bytes]rI� list[_Tile]�bufsizerAc ��|���t|d��sd|_|�t���t t ||jddz��} |���}|� ��t|||||��n7#ttj f$r}t||||d|��Yd}~nd}~wwxYwt|d��r|� ��dSdS)z�Helper to save image based on tile list :param im: Image object. :param fp: File object. :param tile: Tile list. :param bufsize: Optional buffer size � encoderconfigr.ryr�N�flush)r�r�r�r�r/�maxrLr[r�r�� _encode_tilerr��UnsupportedOperation)r�r=rIr��fh�excs r"�_saver�s���G�G�I�I�I� �2�� '� '������I�I�)�I���� �(�G�R�W�Q�Z�!�^�4�4�G�7� �Y�Y�[�[�� ��� � � ��R��T�7�B�/�/�/�/�� �B�3� 4�7�7�7��R��T�7�D�#�6�6�6�6�6�6�6�6�����7�����r�7���� ��� � � � � ��s�,;B(�(C�>C�Cr�� int | Noner��BaseException | Nonec�v�|D�]4\}}}} |dkr|�|��tj|j|| |j��} | �|j|��| jr0| �|��| � ��d} nW|r; | � |��dd�\} } |� | ��| rn�9n|�J�| � ||��} | dkrt| d���|� | �����#| ���wxYwdS)Nrr Tr()r�r � _getencoderrZr�r�r�� pushes_fdr��encode_to_pyfd�encode�write�encode_to_filer#r�) r�r=rIr�r�r�� encoder_namer4r5r6r�errcoder�s r"r�r�3sj��04���+� �g�v�t� �A�:�:� �G�G�F�O�O�O��#�B�G�\�4��AQ�R�R�� � � � �R�U�G� ,� ,� ,�� � B�� � �b�!�!�!�!�0�0�2�2�1�5���� B�"�(/���w�(?�(?����(C� ����������"�"�!� "�"��>�>�>�%�4�4�R��A�A�G���{�{�"�7�D�9�9�9�s�B�� �O�O� � � � ��G�O�O� � � � ����1�s �CD � D6r[rRc���|dkrdS|tkr;|�|��}t|��|krd}t|���|Sg}|}|dkrX|�t |t����}|sn-|�|��|t|��z}|dk�Xt d�|D����|krd}t|���d�|��S)a� Reads large blocks in a safe way. Unlike fp.read(n), this function doesn't trust the user. If the requested size is larger than SAFEBLOCK, the file is read block by block. :param fp: File handle. Must implement a <b>read</b> method. :param size: Number of bytes to read. :returns: A string containing <i>size</i> bytes of data. Raises an OSError if the file is truncated and the read cannot be completed rr)zTruncated File Readc3�4K�|]}t|��V��dSrb)r�)r~�blocks r"� <genexpr>z_safe_read.<locals>.<genexpr>ss(���� *� *�%�3�u�:�:� *� *� *� *� *� *r))� SAFEBLOCKr�r�rr��append�sum�join)r=r[r�r!�blocks�remaining_sizers r"� _safe_readr Vs�� �q�y�y��s� �y����w�w�t�}�}�� �t�9�9�t� � �'�C��#�,�,� �� ��F��N� �1� � �����N�I�6�6�7�7��� � �� � �e�����#�e�*�*�$�� �1� � �  � *� *�6� *� *� *�*�*�T�1�1�#���c�l�l�� �8�8�F� � �r)c��eZdZdd�Zdd�ZdS) � PyCodecStaterrAc�>�d|_d|_d|_d|_dS)Nr)�xsize�ysize�xoff�yoffrcs r"rFzPyCodecState.__init__zs"���� ��� ��� ��� � � r)�tuple[int, int, int, int]c�V�|j|j|j|jz|j|jzfSrb)rrrrrcs r"r4zPyCodecState.extents�s'���y�$�)�T�Y���%;�T�Y���=S�S�Sr)Nr�)rr)r7r8r9rFr4r.r)r"rrysB���������� T�T�T�T�T�Tr)rc�F�eZdZUded<dd �Zdd �Zdd �Zdd�Z ddd�ZdS)�PyCodeczIO[bytes] | None�fdrZr1r6rrrAc��d|_t��|_d|_||_|�|��dSrb)r�rrkrrZ�init)r^rZr6s r"rFzPyCodec.__init__�s5��15���!�^�^�� ������ � � � �$�����r)�tuple[Any, ...]c��||_dS)z� Override to perform codec specific initialization :param args: Tuple of arg items from the tile entry :returns: None N)r6r�s r"rz PyCodec.init�s���� � � r)c��dS)zT Override to perform codec specific cleanup :returns: None Nr.rcs r"r�zPyCodec.cleanup�s �� �r)r�c��||_dS)z� Called from ImageFile to set the Python file-like object :param fd: A Python file-like object :returns: None N)r)r^rs r"r�z PyCodec.setfd�s������r)Nr��Image.core.ImagingCorer4r3c�:�||_|r|\}}}}nd\}}}}|dkr*|dkr$|jj\|j_|j_n6||j_||j_||z |j_||z |j_|jjdks|jjdkrd}t|���|jj|jjz|jjdks-|jj|jjz|jjdkrd}t|���dS)z� Called from ImageFile to set the core output image for the codec :param im: A core image object :param extents: a 4 tuple of (x0, y0, x1, y1) defining the rectangle for this tile :returns: None )rrrrrzSize cannot be negativer z Tile cannot extend outside imageN)r�r[rkrrrr� ValueError)r^r�r4�x0�y0�x1�y1r!s r"r�zPyCodec.setimage�s����� � ,�&� �R��R���+� �R��R�� ��7�7�r�Q�w�w�15��� .�D�J� �d�j�.�.� �D�J�O� �D�J�O�!�B�w�D�J� �!�B�w�D�J� � �:� �q� � �D�J�$4��$9�$9�+�C��S�/�/� !� �J� �t�z�� .����a�� @� @��z��$�*�/�1�D�G�L��O�C�C�4�C��S�/�/� !�D�Cr))rZr1r6rrrA)r6rrrAr�)rr�rrArb)r�rr4r3rrA) r7r8r9r:rFrr�r�r�r.r)r"rr�s�������������������� � � � �����59�'"�'"�'"�'"�'"�'"�'"r)rc�B�eZdZdZdZedd���Zdd �Z ddd�Zd S)� PyDecoderz� Python implementation of a format decoder. Override this class and add the decoding logic in the :meth:`decode` method. See :ref:`Writing Your Own File Codec in Python<file-codecs-py>` Frrc��|jSrb)� _pulls_fdrcs r"r�zPyDecoder.pulls_fd�s ���~�r)�buffer�$bytes | Image.SupportsArrayInterface�tuple[int, int]c�$�d}t|���)a= Override to perform the decoding process. :param buffer: A bytes object with the data to be decoded. :returns: A tuple of ``(bytes consumed, errcode)``. If finished with decoding return -1 for the bytes consumed. Err codes are from :data:`.ImageFile.ERRORS`. zunavailable in base decoderr�)r^r*r!s r"r�zPyDecoder.decode����,��!�#�&�&�&r)Nr.r�rR�rawmodere�extrarrAc�d�|s|j}tj|jd||��}|j�J�|�|j|j�����|�|��}|ddkrd}t|���|ddkrd}t|���dS)aS Convenience method to set the internal image from a stream of raw data :param data: Bytes to be set :param rawmode: The rawmode to be used for the decoder. If not specified, it will default to the mode of the image :param extra: Extra arguments for the decoder. :returns: None rvNrznot enough image datar zcannot decode image data) rZr r�r�r�rkr4r�r!)r^r�r/r0r�r�r!s r"� set_as_rawzPyDecoder.set_as_raw�s���� ��i�G� � �d�i���� ?� ?���w�"�"�"� � � �4�7�D�J�.�.�0�0�1�1�1� �H�H�T�N�N�� �Q�4�1�9�9�)�C��S�/�/� !� �Q�4�1�9�9�,�C��S�/�/� !� �9r)�rr)r*r+rr,)Nr.)r�rRr/rer0rrrA) r7r8r9r�r)�propertyr�r�r2r.r)r"r'r'�sw���������I� �����X�� '� '� '� '�QS�"�"�"�"�"�"�"r)r'c�F�eZdZdZdZedd���Zdd �Zdd �Zdd �Z dS)� PyEncoderz� Python implementation of a format encoder. Override this class and add the decoding logic in the :meth:`encode` method. See :ref:`Writing Your Own File Codec in Python<file-codecs-py>` Frrc��|jSrb)� _pushes_fdrcs r"r�zPyEncoder.pushes_fds ����r)r�r�tuple[int, int, bytes]c�$�d}t|���)a  Override to perform the encoding process. :param bufsize: Buffer size. :returns: A tuple of ``(bytes encoded, errcode, bytes)``. If finished with encoding return 1 for the error code. Err codes are from :data:`.ImageFile.ERRORS`. zunavailable in base encoderr�)r^r�r!s r"r�zPyEncoder.encoder.r)r,c��|jsdS|�d��\}}}|r#|j�J�|j�|��||fS)z� If ``pushes_fd`` is ``True``, then this method will be used, and ``encode()`` will only be called once. :returns: A tuple of ``(bytes consumed, errcode)``. Err codes are from :data:`.ImageFile.ERRORS`. )rrr)r�r�rr�)r^�bytes_consumedrr�s r"r�zPyEncoder.encode_to_pyfd"s^���~� ��5�(,� � �A���%���� � ��7�&�&�&� �G�M�M�$� � � ��w�&�&r)r�c��d}|dkrB|�|��\}}}|dkrtj|||d���|dk�B|S)z� :param fh: File handle. :param bufsize: Buffer size. :returns: If finished successfully, return 0. Otherwise, return an error code. Err codes are from :data:`.ImageFile.ERRORS`. rN)r�rOr�)r^r�r�r�status�bufs r"r�zPyEncoder.encode_to_file2s_������l�l�#'�;�;�w�#7�#7� �F�G�S���z�z����S����\�*�*�*���l�l��r)Nr3)r�rrr9)rr,)r�rr�rrr) r7r8r9r�r8r4r�r�r�r�r.r)r"r6r6s���������J� �����X�� '� '� '� '�'�'�'�'� �����r)r6)rrrrrr)rrrr)r*r+rr)r) r�r�r=r�rIr�r�rrrArb)r�r�r=r�rIr�r�rr�r�r�r�rrA)r=r�r[rrrR))� __future__rr�r�r�rOrXr��typingrrrrrrDr � _deprecater �_utilr �_typingr rLrr�rr#r%r/r+r<r�r�r�r�r�r rrr'r6r.r)r"�<module>rEs-��:#�"�"�"�"�"� � � � � � � � ����� � � � � � � � � � � � �;�;�;�;�;�;�;�;�;�;�;�;�;�;�������!�!�!�!�!�!��������(�'�'�'�'�'�'� �� � ���N� %�����  � �������-�-�-�-����� .�.�.�.�.�J�.�.�.�v$�v$�v$�v$�v$�� �v$�v$�v$�r � � � � � � � �'�'�'�'�'�I�'�'�'�<C�C�C�C�C�C�C�C�R�����D!%� � � � � �F � � � �FT�T�T�T�T�T�T�T�K"�K"�K"�K"�K"�K"�K"�K"�\3"�3"�3"�3"�3"��3"�3"�3"�l8�8�8�8�8��8�8�8�8�8r)
Memory