BYPASS SHELL BY ./RAZORGANZ
Server: nginx/1.20.1
System: Linux iZdzfnv9mwfppeZ 5.10.134-19.2.al8.x86_64 #1 SMP Wed Oct 29 22:47:09 CST 2025 x86_64
User: apache (48)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //usr/local/lib64/python3.6/site-packages/PIL/__pycache__/ImageFile.cpython-36.pyc
3

Zƍh�R�
@s�ddlZddlZddlZddlZddlmZddlmZdZd%Z	dZ
d&dd'd
d(dd)dd*diZdd�Zdd�Z
dd�ZGdd�dej�ZGdd�de�ZGdd�d�Zd+dd�Zdd �ZGd!d"�d"�ZGd#d$�d$�ZdS),�N�)�Image)�isPathiiFzimage buffer overrun error�zdecoding error�z
unknown error�zbad configuration�	zout of memory errorcCsNytjj|�}Wntk
r.tj|�}YnX|s>d|��}t|d��dS)Nzdecoder error z when reading image file)r�coreZgetcodecstatus�AttributeError�ERRORS�get�OSError)�error�message�r�9/usr/local/lib64/python3.6/site-packages/PIL/ImageFile.py�
raise_oserror<s
rcCstjdt�t|�S)Nzdraise_ioerror is deprecated and will be removed in Pillow 9 (2022-01-02). Use raise_oserror instead.)�warnings�warn�DeprecationWarningr)rrrr�
raise_ioerrorFsrcCs|dS)Nrr)�trrr�	_tilesortOsrcsReZdZdZd�fdd�	Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
�ZS)�	ImageFilez*Base class for image file format handlers.Ncs�t�j�d|_d|_d|_d|_f|_t|_t	|�rPt
|d�|_||_d|_
n||_||_d|_
yhy|j�Wn8tttttjfk
r�}zt|�|�WYdd}~XnX|js�|jddkr�td��Wn&tk
r�|j
r�|jj��YnXdS)Nrr�rbTznot identified by this driver)�super�__init__�
_min_frame�custom_mimetype�tile�readonly�
decoderconfig�MAXBLOCK�decodermaxblockr�open�fp�filename�
_exclusive_fp�_open�
IndexError�	TypeError�KeyError�EOFError�structr�SyntaxError�mode�size�
BaseException�close)�selfr%r&�v)�	__class__rrr\s<

zImageFile.__init__cCs,|jr|jS|jdk	r(tjj|jj��SdS)N)r�formatrZMIMEr�upper)r3rrr�get_format_mimetype�s
zImageFile.get_format_mimetypecCs|jr|jj�d|_dS)zCheck file integrityN)r'r%r2)r3rrr�verify�s
zImageFile.verifyc>CsX|jdkrtd��tjj|�}|js(|Sd|_|jo@t|j�dk}|oPttd�}d}y|j	}d}Wnt
k
r�|jj}YnXy|j
}d}Wnt
k
r�|jj}YnX|�r�|jd\}}}}	|dko�t|	�dko�|	d|jko�|	dtjk�r�yhddl}
t|j��}|
j|j�d|
jd	�|_WdQRXtjj|j|j|||	�|_d}|j�r^d|j_Wn"t
ttfk
�r�d|_YnX|j�d}|j�s�|jjtd
�y
|j}
Wnt
k
�r�d}
YnX�x$|jD�]\}}}}	tj |j||	|j!�}z�||�|j"|j|�|j#�r4|j$|j�|j%d�\}}n�|
}x�y||j&�}Wn>t't(j)fk
�r�}zt*�rlPn
td�|�WYdd}~XnX|�s�t*�r�Pntd
t|��d���||}|j%|�\}}|dk�r�P||d�}�q:WWd|j+�X�q�Wg|_||_,|j-�|j.�r"|j/�r"|jj0�d|_|j�rLt*�rL|dk�rLt1|�tjj|�S)z"Load image data based on tile listNzcannot load this imager�pypy_version_inforF�rawr)�access)�key�zimage file is truncatedzimage file is truncated (z bytes not processed)���)2rr
r�load�mapr&�len�hasattr�sys�	load_readr
r%�read�	load_seek�seekr/Z	_MAPMODES�mmapr$�filenoZACCESS_READr	Z
map_bufferr0�imZpaletteZdirty�ImportError�load_prepare�sortrZtile_prefix�_getdecoderr!�setimage�pulls_fd�setfd�decoder#r)r-r�LOAD_TRUNCATED_IMAGES�cleanupr �load_endr'Z!_close_exclusive_fp_after_loadingr2r)r3ZpixelZuse_mmapr rFrHZdecoder_name�extents�offset�argsrIr%Zerr_code�prefix�decoder�status�b�s�e�nrrrr@�s�
"



zImageFile.loadcCsR|js$|jj|jks$|jj|jkr8tjj|j|j�|_|jdkrNtjj|�dS)N�P)rKr/r0rr	�newr@)r3rrrrMs$
zImageFile.load_preparecCsdS)Nr)r3rrrrVszImageFile.load_endcCsD||jks0t|d�o|jdkr8||j|jkr8td��|j�|kS)N�	_n_framesz attempt to seek outside sequence)rrCrcZn_framesr,�tell)r3�framerrr�_seek_check*s

zImageFile._seek_check)NN)�__name__�
__module__�__qualname__�__doc__rr8r9r@rMrVrf�
__classcell__rr)r5rrYs/	|rc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�
StubImageFilez�
    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.
    cCstd��dS)Nz+StubImageFile subclass must implement _open)�NotImplementedError)r3rrrr(AszStubImageFile._opencCsL|j�}|dkr"td|j�d���|j|�}|dk	s8t�|j|_|j|_dS)Nzcannot find loader for this z file)�_loadr
r6r@�AssertionErrorr5�__dict__)r3�loader�imagerrrr@Ds
zStubImageFile.loadcCstd��dS)z (Hook) Find actual image loader.z+StubImageFile subclass must implement _loadN)rm)r3rrrrnNszStubImageFile._loadN)rgrhrirjr(r@rnrrrrrl9s
rlc@sPeZdZdZdZdZdZdZdZdZ	dd�Z
dd�Zdd	�Zd
d�Z
dd
�ZdS)�Parserzj
    Incremental image parser.  This class implements the standard
    feed/close consumer interface.
    NrcCs|jdkstd��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)�dataro)r3rrr�reset`szParser.resetcCs�|jr
dS|jdkr||_n|j||_|jr�|jdkr|tt|j�|j�}|j|d�|_|j||_|jdksx|jr|dS|jj|j�\}}|dkr�d|_d|_|dkr�d|_t|�ndS|j|d�|_n�|jr�n�y&t	j
|j��}tj|�}WdQRXWnt
k
�rYn�Xt|d��p*t|d�}|�sBt|j�dk�rJd|_nv|j�|jd\}}}	}
g|_tj|j||
|j�|_|jj|j|�|	|_|jt|j�k�r�|j|jd�|_d|_||_dS)z�
        (Consumer) Feed data to the parser.

        :param data: A string buffer.
        :exception OSError: If the parser failed to parse the image file.
        NrrrGrE)�finishedrtr[rX�minrBrSrrr�io�BytesIOrr$r
rCrrMrOr/r!rPrK)r3rt�skipr`r_r%rK�flag�d�o�arrr�feedhsR	


zParser.feedcCs|S)Nr)r3rrr�	__enter__�szParser.__enter__cGs|j�dS)N)r2)r3rYrrr�__exit__�szParser.__exit__cCsz|jr*|jd�d|_|_|js*td��|js8td��|jrttj|j��$}ztj	|�|_Wd|jj
�XWdQRX|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)r[rrtrvr
rrrxryrr$r@)r3r%rrrr2�s

zParser.close)rgrhrirj�incrementalrrrtr[rXrvrurr�r�r2rrrrrsSsPrscCs.|j�t|d�sf|_|jtd�tt||jdd�}y|tj	kpP|tj	j
k}Wnttfk
rpd}YnX|r�|j
�dSy|j�}|j
�Wn�ttjfk
�rx}z�x�|D]�\}}}	}
tj|j||
|j�}|	dkr�|j|	�|j|j|�|j�r|j|�|j�\}}n*x(|j|�\}}}
|j|
�|�rP�qW|dk�r\td|�d��|�|j�q�WWYdd}~Xn�Xx�|D]�\}}}	}
tj|j||
|j�}|	dk�r�|j|	�|j|j|�|j�r�|j|�|j�\}}n|j||�}|dk�rtd|�d���|j��q�Wt|d	��r*|j
�dS)
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
    �
encoderconfig)r=r�FNzencoder error z when writing image file�flush)r@rCr�rNr�maxr"r0rD�stdout�bufferr
r
r�rJrx�UnsupportedOperationrZ_getencoderr/rHrPrKZ	pushes_fdrRZencode_to_pyfd�encode�writerUZencode_to_file)rKr%r�bufsizer��fh�excr_r]r}r~�lr^r|rrr�_save�s\	









r�cCs�|dkrdS|tkr6|j|�}t|�|kr2td��|Sg}x8|dkrr|jt|t��}|sZP|j|�|t|�8}q<Wtdd�|D��|kr�td��dj|�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 Readcss|]}t|�VqdS)N)rB)�.0r|rrr�	<genexpr>;sz_safe_read.<locals>.<genexpr>)�	SAFEBLOCKrFrBr
rw�append�sum�join)r%r0rt�blockrrr�
_safe_read s"



r�c@seZdZdd�Zdd�ZdS)�PyCodecStatecCsd|_d|_d|_d|_dS)Nr)�xsize�ysize�xoff�yoff)r3rrrrAszPyCodecState.__init__cCs |j|j|j|j|j|jfS)N)r�r�r�r�)r3rrrrWGszPyCodecState.extentsN)rgrhrirrWrrrrr�@sr�c@s\eZdZdZdZdd�Zdd�Zedd��Zd	d
�Z	dd�Z
d
d�Zddd�Zddd�Z
dS)�	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 Decoder in Python<file-decoders-py>`
    FcGs(d|_t�|_d|_||_|j|�dS)N)rKr��state�fdr/�init)r3r/rYrrrrUs
zPyDecoder.__init__cCs
||_dS)z�
        Override to perform decoder specific initialization

        :param args: Array of args items from the tile entry
        :returns: None
        N)rY)r3rYrrrr�\szPyDecoder.initcCs|jS)N)�	_pulls_fd)r3rrrrQeszPyDecoder.pulls_fdcCs
t��dS)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 <0 for the bytes consumed.
            Err codes are from :data:`.ImageFile.ERRORS`.
        N)rm)r3r�rrrrSis	zPyDecoder.decodecCsdS)zV
        Override to perform decoder specific cleanup

        :returns: None
        Nr)r3rrrrUtszPyDecoder.cleanupcCs
||_dS)z�
        Called from ImageFile to set the python file-like object

        :param fd: A python file-like object
        :returns: None
        N)r�)r3r�rrrrR|szPyDecoder.setfdNcCs�||_|r|\}}}}nd\}}}}|dkrJ|dkrJ|jj\|j_|j_n(||j_||j_|||j_|||j_|jjdks�|jjdkr�td��|jj|jj|jjdks�|jj|jj|jjdkr�td��dS)z�
        Called from ImageFile to set the core output image for the decoder

        :param im: A core image object
        :param extents: a 4 tuple of (x0, y0, x1, y1) defining the rectangle
            for this tile
        :returns: None
        rzSize cannot be negativerz Tile cannot extend outside imageN)rrrr)rKr0r�r�r�r�r��
ValueError)r3rKrWZx0Zy0�x1�y1rrrrP�szPyDecoder.setimagecCsd|s
|j}tj|jd|�}|j|j|jj��|j|�}|ddkrLtd��|ddkr`td��dS)a
        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
        :returns: None
        r;rznot enough image datarzcannot decode image dataN)	r/rrOrPrKr�rWrSr�)r3rt�rawmoder|r^rrr�
set_as_raw�s

zPyDecoder.set_as_raw)N)N)rgrhrirjr�rr��propertyrQrSrUrRrPr�rrrrr�Ks		
#r�i������r?i����i����)r)rxr-rDr�rZ_utilrr"r�rTrrrrrrlrsr�r�r�r�rrrr�<module>s2

	
a
B