Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/werkzeug/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/werkzeug/__pycache__/formparser.cpython-312.pyc

�

'ٜg�=���ddlmZddlZddlmZddlmZddlm	Z	ddl
mZddl
mZdd	l
m
Z
dd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZ	ddlmZej@r>ddlZ!ddl"m#Z#e$ejJe&e
e'e'fe
e'effZ(Gd�de!jR�Z*ejVdejXdejZf��Z.	d$									d%d�Z/					d&dd�															d'd�Z0Gd�d �Z1Gd!�d"�Z2d(d#�Z3y#e$rddlmZdZY��wxYw))�)�annotationsN)�BytesIO)�	parse_qsl�)�
_plain_int)�FileStorage)�Headers)�	MultiDict)�RequestEntityTooLarge)�parse_options_header)�Data)�Epilogue)�Field)�File)�MultipartDecoder)�NeedData)�get_content_length)�get_input_stream)�SpooledTemporaryFile)�
TemporaryFile)�WSGIEnvironmentc�*�eZdZ	d									dd�Zy)�TStreamFactoryNc��y�N�)�self�total_content_length�content_type�filename�content_lengths     �>/usr/local/lib/python3.12/site-packages/werkzeug/formparser.py�__call__zTStreamFactory.__call__)s���r�
r�
int | Noner�
str | Noner r'r!r&�return�t.IO[bytes])�__name__�
__module__�__qualname__r#rr$r"rr(s<��*.�	�",�	�%�	�!�		�
'�	��
	r$r�F.)�boundc��d}t�6tjtjtt|d���S|�||kDr4tjtjttd��St
�S)Ni�zrb+)�max_size�mode)r�t�cast�IO�bytesrr)rrr r!r0s     r"�default_stream_factoryr65se���H��'��v�v�a�d�d�5�k�#7��PU�#V�W�W�	�	%�)=��)H��v�v�a�d�d�5�k�=��#7�8�8��9�r$��max_form_partsc�B�t||||||��j|�S)a�Parse the form data in the environ and return it as tuple in the form
    ``(stream, form, files)``.  You should only call this method if the
    transport method is `POST`, `PUT`, or `PATCH`.

    If the mimetype of the data transmitted is `multipart/form-data` the
    files multidict will be filled with `FileStorage` objects.  If the
    mimetype is unknown the input stream is wrapped and returned as first
    argument, else the stream is empty.

    This is a shortcut for the common usage of :class:`FormDataParser`.

    :param environ: the WSGI environment to be used for parsing.
    :param stream_factory: An optional callable that returns a new read and
                           writeable file descriptor.  This callable works
                           the same as :meth:`Response._get_file_stream`.
    :param max_form_memory_size: the maximum number of bytes to be accepted for
                           in-memory stored form data.  If the data
                           exceeds the value specified an
                           :exc:`~exceptions.RequestEntityTooLarge`
                           exception is raised.
    :param max_content_length: If this is provided and the transmitted data
                               is longer than this value an
                               :exc:`~exceptions.RequestEntityTooLarge`
                               exception is raised.
    :param cls: an optional dict class to use.  If this is not specified
                       or `None` the default :class:`MultiDict` is used.
    :param silent: If set to False parsing errors will not be caught.
    :param max_form_parts: The maximum number of multipart parts to be parsed. If this
        is exceeded, a :exc:`~exceptions.RequestEntityTooLarge` exception is raised.
    :return: A tuple in the form ``(stream, form, files)``.

    .. versionchanged:: 3.0
        The ``charset`` and ``errors`` parameters were removed.

    .. versionchanged:: 2.3
        Added the ``max_form_parts`` parameter.

    .. versionadded:: 0.5.1
       Added the ``silent`` parameter.

    .. versionadded:: 0.5
       Added the ``max_form_memory_size``, ``max_content_length``, and ``cls``
       parameters.
    )�stream_factory�max_form_memory_size�max_content_lengthr8�silent�cls)�FormDataParser�parse_from_environ)�environr:r;r<r>r=r8s       r"�parse_form_datarBEs1��l�%�1�-�%���
����!�"r$c��eZdZdZ					d	dd�													d
d�Zdd�Z	d									d
d�Z										dd�Z										dd�Zy)r?aThis class implements parsing of form data for Werkzeug.  By itself
    it can parse multipart and url encoded form data.  It can be subclassed
    and extended but for most mimetypes it is a better idea to use the
    untouched stream and expose it as separate attributes on a request
    object.

    :param stream_factory: An optional callable that returns a new read and
                           writeable file descriptor.  This callable works
                           the same as :meth:`Response._get_file_stream`.
    :param max_form_memory_size: the maximum number of bytes to be accepted for
                           in-memory stored form data.  If the data
                           exceeds the value specified an
                           :exc:`~exceptions.RequestEntityTooLarge`
                           exception is raised.
    :param max_content_length: If this is provided and the transmitted data
                               is longer than this value an
                               :exc:`~exceptions.RequestEntityTooLarge`
                               exception is raised.
    :param cls: an optional dict class to use.  If this is not specified
                       or `None` the default :class:`MultiDict` is used.
    :param silent: If set to False parsing errors will not be caught.
    :param max_form_parts: The maximum number of multipart parts to be parsed. If this
        is exceeded, a :exc:`~exceptions.RequestEntityTooLarge` exception is raised.

    .. versionchanged:: 3.0
        The ``charset`` and ``errors`` parameters were removed.

    .. versionchanged:: 3.0
        The ``parse_functions`` attribute and ``get_parse_func`` methods were removed.

    .. versionchanged:: 2.2.3
        Added the ``max_form_parts`` parameter.

    .. versionadded:: 0.8
    Nr7c��|�t}||_||_||_||_|�tjdt�}||_||_	y�Nztype[MultiDict[str, t.Any]])
r6r:r;r<r8r2r3r
r>r=)rr:r;r<r>r=r8s       r"�__init__zFormDataParser.__init__�sS���!�3�N�,���$8��!�"4���,����;��&�&�6�	�B�C������r$c��t||j��}t|�}t|j	d��\}}|j||||��S)z�Parses the information from the environment as form data.

        :param environ: the WSGI environment to be used for parsing.
        :return: A tuple in the form ``(stream, form, files)``.
        )r<�CONTENT_TYPE)r!�mimetype�options)rr<rr�get�parse)rrA�streamr!rIrJs      r"r@z!FormDataParser.parse_from_environ�sZ��"�'�d�>U�>U�V��+�G�4��0����^�1L�M���'��z�z��)���	�
�	
r$c�&�|dk(r
|j}n3|dk(r
|j}n!||j�|j�fS|�i}	|||||�S#t$r|js�YnwxYw||j�|j�fS)avParses the information from the given stream, mimetype,
        content length and mimetype parameters.

        :param stream: an input stream
        :param mimetype: the mimetype of the data
        :param content_length: the content length of the incoming data
        :param options: optional mimetype parameters (used for
                        the multipart boundary for instance)
        :return: A tuple in the form ``(stream, form, files)``.

        .. versionchanged:: 3.0
            The invalid ``application/x-url-encoded`` content type is not
            treated as ``application/x-www-form-urlencoded``.
        zmultipart/form-dataz!application/x-www-form-urlencoded)�_parse_multipart�_parse_urlencodedr>�
ValueErrorr=)rrMrIr!rJ�
parse_funcs      r"rLzFormDataParser.parse�s���*�,�,��.�.�J�
�<�
<��/�/�J��4�8�8�:�t�x�x�z�1�1��?��G�	��f�h���H�H���	��;�;���	���t�x�x�z�4�8�8�:�-�-s�
A�A/�.A/c��t|j|j|j|j��}|jdd�j
d�}|std��|j|||�\}}|||fS)N)r:r;r8r>�boundary��asciizMissing boundary)	�MultiPartParserr:r;r8r>rK�encoderQrL)	rrMrIr!rJ�parserrT�form�filess	         r"rOzFormDataParser._parse_multipart�s��!��.�.�!%�!:�!:��.�.����	
���;�;�z�2�.�5�5�g�>����/�0�0��l�l�6�8�^�D���e��t�U�"�"r$c���|j�|�||jkDr
t��t|j�j	�dd��}||j|�|j�fS)NTzwerkzeug.url_quote)�keep_blank_values�errors)r;rr�read�decoder>)rrMrIr!rJ�itemss      r"rPz FormDataParser._parse_urlencodedsl��
�%�%�1��*���!:�!:�:�'�)�)���K�K�M� � �"�"�'�
��
�t�x�x������
�2�2r$�NNNNT)r:�TStreamFactory | Noner;r&r<r&r>�"type[MultiDict[str, t.Any]] | Noner=�boolr8r&r(�None)rArr(�t_parse_resultr)
rMr)rI�strr!r&rJzdict[str, str] | Noner(rg)
rMr)rIrhr!r&rJzdict[str, str]r(rg)	r*r+r,�__doc__rFr@rLrOrPrr$r"r?r?�s��"�L15�+/�)-�26��
�&*��-��)��'�	�
0���
�#��
��0
�**.�%.��%.��%.�#�	%.�
'�%.�
�
%.�N#��#��#�#�	#�
 �#�
�
#�*3��3��3�#�	3�
 �3�
�
3r$r?c�r�eZdZ					d											dd�Zd	d�Zd
d�Z						dd�Z								dd�Zy)
rWNc��||_||_|�t}||_|�t	j
dt�}||_||_yrE)	r;r8r6r:r2r3r
r>�buffer_size)rr:r;r>rlr8s      r"rFzMultiPartParser.__init__%sL��%9��!�,����!�3�N�,����;��&�&�6�	�B�C����&��r$c��t|��r)rQ)r�messages  r"�failzMultiPartParser.fail;s
����!�!r$c��|jd�}|r4t|�d}|jdd�j�}|dvr|Sy)N�content-typer�charsetrU>�us-ascii�
iso-8859-1rV�utf-8ru)rKr�lower)r�headersr�
parameters�
ct_charsets     r"�get_part_charsetz MultiPartParser.get_part_charset>sO���{�{�>�2���-�l�;�A�>�J�#���	�2�6�<�<�>�J��I�I�!�!�r$c���|jjd�}	t|jd�}|j||j||��}|S#ttf$rd}Y�4wxYw)Nrqzcontent-lengthr)rr rr!)rwrKr�KeyErrorrQr:r )r�eventrrr!�	containers      r"�start_file_streamingz$MultiPartParser.start_file_streamingMs{���}�}�(�(��8��	�'��
�
�6F�(G�H�N��'�'�!5��^�^�%�)�	(�
�	�����*�%�	��N�	�s�A�A*�)A*c
��d}t||j|j��}g}g}t|j|j
�D�]}|j
|�|j�}	t|	ttf�r�<t|	t�r|	}
d}g}|j}�n�t|	t�r$|	}
d}|j|	|�}|j}�nZt|	t ��rI|j�3|�1|t#|	j$�z
}||jkDr
t'��|	j$�|	j(s�t
t�rXdj+�j-|j/|
j0�d�}
|j|
j2|
f�n�t5j6t4j8t:�}|j=d�|j|
j2t?||
j@|
j2|
j0��f�|j�}	t|	ttf�s��ڐ�|jC|�|jC|�fS)N)r;�	max_partsrr$�replace)rw)"rr;r8�_chunk_iterr_rl�receive_data�
next_event�
isinstancerrr�appendrr�writer
�len�datar�	more_data�joinr`rzrw�namer2r3r4r5�seekrr r>)rrMrTr!�
field_sizerY�fieldsr[r�r}�current_partr~�_write�values              r"rLzMultiPartParser.parse_s"��"&�
�"��!%�!:�!:��)�)�
����������T�-=�-=�>�D�����%��%�%�'�E� ���8�(<�=��e�U�+�#(�L�!"�J� "�I�&�-�-�F���t�,�#(�L�!%�J� $� 9� 9�%�� P�I�&�_�_�F���t�,��0�0�<��AW�#�c�%�*�*�o�5�
�%��(A�(A�A�"7�"9�9��5�:�:�&� �?�?�%�l�E�:�$'�H�H�Y�$7�$>�$>� $� 5� 5�l�6J�6J� K�Y�%�E�#�M�M�<�+<�+<�e�*D�E�()���q�t�t�E�{�I�(F�I�%�N�N�1�-�!�L�L�$0�$5�$5�$/�(1�(4�(=�(=�(4�(9�(9�0<�0D�0D�	%&�!"�
��)�)�+��U!���8�(<�=�=�?�^�x�x������%��0�0r$)NNNiN)r:rcr;r&r>rdrl�intr8r&r(rf)rnrhr(zte.NoReturn)rwr	r(rh)r}rrr&r(r))rMr)rTr5r!r&r(z7tuple[MultiDict[str, str], MultiDict[str, FileStorage]])r*r+r,rFrorzrrLrr$r"rWrW$s���15�+/�26�$�%)�
'�-�'�)�'�0�	'�
�'�#�
'�
�'�,"�
����1;��	��$@1�!�@1�-2�@1�DN�@1�	@�@1r$rWc#�6K�	||�}|sn|���d��y�w)z�Read data in chunks for multipart/form-data parsing. Stop if no data is read.
    Yield ``None`` at the end to signal end of parsing.
    Nr)r_�sizer�s   r"r�r��s+������D�z�����
�
��J�s�rr%rb)rArr:rcr;r&r<r&r>rdr=rer8r&r(rg)r_zt.Callable[[int], bytes]r�r�r(zt.Iterator[bytes | None])4�
__future__r�typingr2�ior�urllib.parser�	_internalr�datastructuresrr	r
�
exceptionsr�httpr�sansio.multipartr
rrrrr�wsgirr�tempfiler�ImportErrorr�
TYPE_CHECKING�te�_typeshed.wsgir�tupler4r5rhrg�Protocolr�TypeVar�Callable�Anyr-r6rBr?rWr�rr$r"�<module>r�s���"���"�!�'�#�%�-�&�"�&�#�"�.�&�$�"� �-��?�?��.��	���U��Y�s�C�x�(�)�C��4D�*E�E��N�������A�I�I�c����C����J�/�0��"&�	
�$�
��
��
��	
�
�
�$-1�'+�%)�.2��
="�"&�="�
�="�)�="�%�="�#�	="�

,�="�
�
="��="��="�@\3�\3�~{1�{1�|��Q� �&��� �s�,D-�-
D=�<D=

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists