Sindbad~EG File Manager

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

�

'ٜg�~��Z�ddlmZddlZddlZddlmZddlmZddl	m
Z
ddlmZddlm
Z
dd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZej<rddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$dd�Z%Gd�de�ZGd�d�Z&y)�)�annotationsN)�
HTTPStatus)�urljoin�)�_get_environ)�Headers)�
generate_etag)�	http_date)�is_resource_modified)�parse_etags)�parse_range_header)�remove_entity_headers)�Response)�
iri_to_uri)�cached_property)�
_RangeWrapper)�ClosingIterator)�get_current_url)�
StartResponse)�WSGIApplication)�WSGIEnvironment�)�Requestc#�hK�|D])}t|t�r|j����&|���+y�w�N)�
isinstance�str�encode)�iterable�items  �E/usr/local/lib/python3.12/site-packages/werkzeug/wrappers/response.py�
_iter_encodedr"s+�������d�C� ��+�+�-���J�	�s�02c���eZdZUdZdZdZdZded<						d)													d*�fd�
Zd+d�Z	d,d�Z
e	d-					d.d	��Ze	d/							d0d
��Z
ejd/d1d��Zejd2d��Zd/d3d
�Zd4d�Zeeed��Zd5d�Zd/d6d�Zd7d�Zd8d�Zed9d��Zed9d��Zd7d�Zd:d�Zd�Zd7d�Zd;d�Zd<d�Z				d=d�Z 						d>d�Z!e"Z#ed?d��Z"ejd@dAd ��Z$ejd@dBd!��Z$dCdBd"�Z$e%dDd#��Z&dEd$�Z'dFd%�Z(								dGd&�Z)		dH							dId'�Z*dCdJd(�Z+�xZ,S)Kra�Represents an outgoing WSGI HTTP response with body, status, and
    headers. Has properties and methods for using the functionality
    defined by various HTTP specs.

    The response body is flexible to support different use cases. The
    simple form is passing bytes, or a string which will be encoded as
    UTF-8. Passing an iterable of bytes or strings makes this a
    streaming response. A generator is particularly useful for building
    a CSV file in memory or using SSE (Server Sent Events). A file-like
    object is also iterable, although the
    :func:`~werkzeug.utils.send_file` helper should be used in that
    case.

    The response object is itself a WSGI application callable. When
    called (:meth:`__call__`) with ``environ`` and ``start_response``,
    it will pass its status and headers to ``start_response`` then
    return its body as an iterable.

    .. code-block:: python

        from werkzeug.wrappers.response import Response

        def index():
            return Response("Hello, World!")

        def application(environ, start_response):
            path = environ.get("PATH_INFO") or "/"

            if path == "/":
                response = index()
            else:
                response = Response("Not Found", status=404)

            return response(environ, start_response)

    :param response: The data for the body of the response. A string or
        bytes, or tuple or list of strings or bytes, for a fixed-length
        response, or any other iterable of strings or bytes for a
        streaming response. Defaults to an empty body.
    :param status: The status code for the response. Either an int, in
        which case the default status message is added, or a string in
        the form ``{code} {message}``, like ``404 Not Found``. Defaults
        to 200.
    :param headers: A :class:`~werkzeug.datastructures.Headers` object,
        or a list of ``(key, value)`` tuples that will be converted to a
        ``Headers`` object.
    :param mimetype: The mime type (content type without charset or
        other parameters) of the response. If the value starts with
        ``text/`` (or matches some other special cases), the charset
        will be added to create the ``content_type``.
    :param content_type: The full content type of the response.
        Overrides building the value from ``mimetype``.
    :param direct_passthrough: Pass the response body directly through
        as the WSGI iterable. This can be used when the body is a binary
        file or other iterator of bytes, to skip some unnecessary
        checks. Use :func:`~werkzeug.utils.send_file` instead of setting
        this manually.

    .. versionchanged:: 2.1
        Old ``BaseResponse`` and mixin classes were removed.

    .. versionchanged:: 2.0
        Combine ``BaseResponse`` and mixins into a single ``Response``
        class.

    .. versionchanged:: 0.5
        The ``direct_passthrough`` parameter was added.
    TFz#t.Iterable[str] | t.Iterable[bytes]�responsec����t�|�||||��||_g|_|�g|_yt|tttf�r|j|�y||_y)N)�status�headers�mimetype�content_type)
�super�__init__�direct_passthrough�	_on_closer$rr�bytes�	bytearray�set_data)�selfr$r&r'r(r)r,�	__class__s       �r!r+zResponse.__init__�sg���	������%�		�	
�#5���68������D�M�
��3��y�"9�
:��M�M�(�#�$�D�M�c�<�|jj|�|S)aAdds a function to the internal list of functions that should
        be called as part of closing down the response.  Since 0.7 this
        function also returns the function that was passed so that this
        can be used as a decorator.

        .. versionadded:: 0.6
        )r-�append�r1�funcs  r!�
call_on_closezResponse.call_on_close�s��	
�����d�#��r3c���|jr+ttt|j	����d�}n|j
rdnd}dt
|�j�d|�d|j�d�S)Nz bytes�streamedzlikely-streamed�<� z [z]>)	�is_sequence�sum�map�len�iter_encoded�is_streamed�type�__name__r&)r1�	body_infos  r!�__repr__zResponse.__repr__�sg������s�3��(9�(9�(;�<�=�>�f�E�I�&*�&6�&6�
�<M�I��4��:�&�&�'�q���2�d�k�k�]�"�E�Er3c�x�t|t�s"|�td��ddlm}t|||��}||_|S)a�Enforce that the WSGI response is a response object of the current
        type.  Werkzeug will use the :class:`Response` internally in many
        situations like the exceptions.  If you call :meth:`get_response` on an
        exception you will get back a regular :class:`Response` object, even
        if you are using a custom subclass.

        This method can enforce a given response type, and it will also
        convert arbitrary WSGI callables into response objects if an environ
        is provided::

            # convert a Werkzeug response object into an instance of the
            # MyResponseClass subclass.
            response = MyResponseClass.force_type(response)

            # convert any WSGI application into a response object
            response = MyResponseClass.force_type(response, environ)

        This is especially useful if you want to post-process responses in
        the main dispatcher and use functionality provided by your subclass.

        Keep in mind that this will modify response objects in place if
        possible!

        :param response: a response object or wsgi application.
        :param environ: a WSGI environment object.
        :return: a response object.
        zHcannot convert WSGI application into response objects without an environr��run_wsgi_app)rr�	TypeError�testrIr2)�clsr$�environrIs    r!�
force_typezResponse.force_type�sH��>�(�H�-����2���

,���h��!@�A�H� ����r3c�(�ddlm}|||||��S)a�Create a new response object from an application output.  This
        works best if you pass it an application that returns a generator all
        the time.  Sometimes applications may use the `write()` callable
        returned by the `start_response` function.  This tries to resolve such
        edge cases automatically.  But if you don't get the expected output
        you should set `buffered` to `True` which enforces buffering.

        :param app: the WSGI application to execute.
        :param environ: the WSGI environment to execute against.
        :param buffered: set to `True` to enforce buffering.
        :return: a response object.
        rrH)rKrI)rL�apprM�bufferedrIs     r!�from_appzResponse.from_app�s�� 	(��L��g�x�8�9�9r3c��yr��r1�as_texts  r!�get_datazResponse.get_datas��DGr3c��yrrTrUs  r!rWzResponse.get_data	s��9<r3c��|j�dj|j��}|r|j�S|S)a�The string representation of the response body.  Whenever you call
        this property the response iterable is encoded and flattened.  This
        can lead to unwanted behavior if you stream big data.

        This behavior can be disabled by setting
        :attr:`implicit_sequence_conversion` to `False`.

        If `as_text` is set to `True` the return value will be a decoded
        string.

        .. versionadded:: 0.9
        r3)�_ensure_sequence�joinrA�decode)r1rV�rvs   r!rWzResponse.get_datas;��	
����
�X�X�d�'�'�)�
*����9�9�;���	r3c��t|t�r|j�}|g|_|jr"tt|��|jd<yy)z�Sets a new string as response.  The value must be a string or
        bytes. If a string is set it's encoded to the charset of the
        response (utf-8 by default).

        .. versionadded:: 0.9
        �Content-LengthN)rrrr$� automatically_set_content_lengthr@r'�r1�values  r!r0zResponse.set_data!sG���e�S�!��L�L�N�E����
��0�0�-0��U��_�D�L�L�)�*�1r3z>A descriptor that calls :meth:`get_data` and :meth:`set_data`.)�docc��	|j�td�|j�D��S#t$rYywxYw)z<Returns the content length if available or `None` otherwise.Nc3�2K�|]}t|����y�wr�r@��.0�xs  r!�	<genexpr>z4Response.calculate_content_length.<locals>.<genexpr>:s����7�#6�a�3�q�6�#6���)rZ�RuntimeErrorr>rA�r1s r!�calculate_content_lengthz!Response.calculate_content_length4sC��	��!�!�#��7�4�#4�#4�#6�7�7�7���	��	�s�2�	>�>c��|jr7|r4t|jt�st|j�|_y|jrtd��|jstd��|j�y)z�This method can be called by methods that need a sequence.  If
        `mutable` is true, it will also ensure that the response sequence
        is a standard Python list.

        .. versionadded:: 0.6
        Nz]Attempted implicit sequence conversion but the response object is in direct passthrough mode.z�The response object required the iterable to be a sequence, but the implicit conversion was disabled. Call make_sequence() yourself.)r=rr$�listr,rl�implicit_sequence_conversion�
make_sequence)r1�mutables  r!rZzResponse._ensure_sequence<sw������z�$�-�-��>� $�T�]�]� 3��
���"�"��B��
��0�0��2��
�
	
���r3c��|jsJt|jdd�}t|j	��|_|�|j|�yyy)aCConverts the response iterator in a list.  By default this happens
        automatically if required.  If `implicit_sequence_conversion` is
        disabled, this method is not automatically called and some properties
        might raise exceptions.  This also encodes all the items.

        .. versionadded:: 0.6
        �closeN)r=�getattrr$rprAr8)r1rus  r!rrzResponse.make_sequenceUsT������D�M�M�7�D�9�E� ��!2�!2�!4�5�D�M�� ��"�"�5�)�!�
 r3c�,�t|j�S)aIter the response encoded with the encoding of the response.
        If the response object is invoked as WSGI application the return
        value of this method is used as application iterator unless
        :attr:`direct_passthrough` was activated.
        )r"r$rms r!rAzResponse.iter_encodedfs���T�]�]�+�+r3c�Z�	t|j�y#ttf$rYywxYw)a�If the response is streamed (the response is not an iterable with
        a length information) this property is `True`.  In this case streamed
        means that there is no information about the number of iterations.
        This is usually `True` if a generator is passed to the response object.

        This is useful for checking before applying some sort of post
        filtering that should not take place for streamed responses.
        TF)r@r$rJ�AttributeErrorrms r!rBzResponse.is_streamedqs1��	���
�
�����>�*�	��	�s��*�*c�B�t|jttf�S)z�If the iterator is buffered, this property will be `True`.  A
        response object will consider an iterator to be buffered if the
        response attribute is a list or tuple.

        .. versionadded:: 0.6
        )rr$�tuplerprms r!r=zResponse.is_sequence�s���$�-�-�%���7�7r3c��t|jd�r|jj�|jD]	}|��y)z�Close the wrapped response if possible.  You can also use the object
        in a with statement which will automatically close it.

        .. versionadded:: 0.9
           Can now be used in a with statement.
        ruN)�hasattrr$rur-r6s  r!ruzResponse.close�s5���4�=�=�'�*��M�M���!��N�N�D��F�#r3c��|SrrTrms r!�	__enter__zResponse.__enter__�s���r3c�$�|j�yr)ru)r1�exc_type�	exc_value�tbs    r!�__exit__zResponse.__exit__�s���
�
�r3c���t|j��|_tt	tt|j���|jd<|j�y)aMMake the response object ready to be pickled. Does the
        following:

        *   Buffer the response into a list, ignoring
            :attr:`implicity_sequence_conversion` and
            :attr:`direct_passthrough`.
        *   Set the ``Content-Length`` header.
        *   Generate an ``ETag`` header if one is not already set.

        .. versionchanged:: 2.1
            Removed the ``no_etag`` parameter.

        .. versionchanged:: 2.0
            An ``ETag`` header is always added.

        .. versionchanged:: 0.6
            The ``Content-Length`` header is set.
        r_N)	rprAr$rr>r?r@r'�add_etagrms r!�freezezResponse.freeze�sF��*�T�.�.�0�1��
�),�S��S�$�-�-�1H�-I�)J����%�&��
�
�r3c�v�t|j�}d}d}d}|j}|D]-\}}|j�}	|	dk(r|}�|	dk(r|}�&|	dk(s�,|}�/|�@t	|�}|j
r$t
|d��}
t	|
�}
t|
|�}||d<|�t	|�|d<d	|cxkrd
ksn|dk(r|jd�n|d
k(rt|�|jrM|jrA|�?|dvr;d	|cxkrd
ks0ntd�|j�D��}t|�|d<|S)akThis is automatically called right before the response is started
        and returns headers modified for the given environment.  It returns a
        copy of the headers from the response with some modifications applied
        if necessary.

        For example the location header (if present) is joined with the root
        URL of the environment.  Also the content length is automatically set
        to zero here for certain status codes.

        .. versionchanged:: 0.6
           Previously that function was called `fix_headers` and modified
           the response object in place.  Also since 0.6, IRIs in location
           and content-location headers are handled properly.

           Also starting with 0.6, Werkzeug will attempt to set the content
           length if it is able to figure it out on its own.  This is the
           case if all the strings in the response iterable are already
           encoded and the iterable is buffered.

        :param environ: the WSGI environment of the request.
        :return: returns a new :class:`~werkzeug.datastructures.Headers`
                 object.
        N�locationzcontent-location�content-lengthT)�strip_querystring�LocationzContent-Location�d����r_�0�r�r�c3�2K�|]}t|����y�wrrfrgs  r!rjz,Response.get_wsgi_headers.<locals>.<genexpr>s���� E�1D�A��Q��1D�rk)rr'�status_code�lowerr�autocorrect_location_headerrr�removerr`r=r>rAr)r1rMr'r��content_location�content_lengthr&�keyrb�ikey�current_urls           r!�get_wsgi_headerszResponse.get_wsgi_headers�s`��0�$�,�,�'��#��'+��+/���!�!��
"�J�C���9�9�;�D��z�!� ���+�+�#(� ��)�)�!&��"���!�(�+�H��/�/�-�g��N��(��5��"�;��9��"*�G�J���'�*4�5E�*F�G�&�'��&��3��&�C�-�
�N�N�+�,�
�s�]�!�'�*�
�1�1�� � ��&��j�(��F�(�S�(� � E��1B�1B�1D� E�E�N�(+�N�(;�G�$�%��r3c���|j}|ddk(sd|cxkrdksn|dvrd}n(|jr|jS|j�}t	||j
�S)aReturns the application iterator for the given environ.  Depending
        on the request method and the current status code the return value
        might be an empty response rather than the one from the response.

        If the request method is `HEAD` or the status code is in a range
        where the HTTP specification requires an empty response, an empty
        iterable is returned.

        .. versionadded:: 0.6

        :param environ: the WSGI environment of the request.
        :return: a response iterable.
        �REQUEST_METHOD�HEADr�r�r�rT)r�r,r$rArru)r1rMr&rs    r!�get_app_iterzResponse.get_app_itersi���!�!���$�%��/��f�"�s�"���#�*,�H�
�
$�
$��=�=� ��(�(�*�H��x����4�4r3c��|j|�}|j|�}||j|j�fS)aFReturns the final WSGI response as tuple.  The first item in
        the tuple is the application iterator, the second the status and
        the third the list of headers.  The response returned is created
        specially for the given environment.  For example if the request
        method in the WSGI environment is ``'HEAD'`` the response will
        be empty and only the headers and status code will be present.

        .. versionadded:: 0.6

        :param environ: the WSGI environment of the request.
        :return: an ``(app_iter, status, headers)`` tuple.
        )r�r�r&�to_wsgi_list)r1rMr'�app_iters    r!�get_wsgi_responsezResponse.get_wsgi_response#s>���'�'��0���$�$�W�-������g�&:�&:�&<�<�<r3c�B�|j|�\}}}|||�|S)z�Process this response as WSGI application.

        :param environ: the WSGI environment.
        :param start_response: the response callable provided by the WSGI
                               server.
        :return: an application iterator
        )r�)r1rM�start_responser�r&r's      r!�__call__zResponse.__call__6s*��%)�$:�$:�7�$C�!��&�'��v�w�'��r3c�"�|j�S)z�The parsed JSON data if :attr:`mimetype` indicates JSON
        (:mimetype:`application/json`, see :attr:`is_json`).

        Calls :meth:`get_json` with default arguments.
        )�get_jsonrms r!�jsonz
Response.jsonJs���}�}��r3c��yrrT�r1�force�silents   r!r�zResponse.get_jsonSs��TWr3c��yrrTr�s   r!r�zResponse.get_jsonVs��ORr3c��|s
|jsy|j�}	|jj|�S#t$r|s�YywxYw)a�Parse :attr:`data` as JSON. Useful during testing.

        If the mimetype does not indicate JSON
        (:mimetype:`application/json`, see :attr:`is_json`), this
        returns ``None``.

        Unlike :meth:`Request.get_json`, the result is not cached.

        :param force: Ignore the mimetype and always try to parse JSON.
        :param silent: Silence parsing errors and return ``None``
            instead.
        N)�is_jsonrW�json_module�loads�
ValueError)r1r�r��datas    r!r�zResponse.get_jsonYsO��������}�}���	��#�#�)�)�$�/�/���	����		�s�<�A�
Ac��t|�S)z+The response iterable as write-only stream.)�ResponseStreamrms r!�streamzResponse.streamus���d�#�#r3c�\�|jdk(rt|j||�|_yy)z8Wrap existing Response in case of Range Request context.��N)r�rr$)r1�start�lengths   r!�_wrap_range_responsezResponse._wrap_range_responsezs)�����s�"�)�$�-�-���G�D�M�#r3c��d|vxsCt||jjd�d|jjd�d��xrd|vS)z�Return ``True`` if `Range` header is present and if underlying
        resource is considered unchanged when compared with `If-Range` header.
        �
HTTP_IF_RANGE�etagN�
last-modifiedF)�ignore_if_range�
HTTP_RANGE)rr'�get)r1rMs  r!�_is_range_request_processablez&Response._is_range_request_processables_��

�7�*�
�'����� � ��(����� � ��1� %���	&��g�%�		&r3c��ddlm}|r|�|dk(s|j|�sy|durd}t|j	d��}|�||��|j|�}|j
|�}|�|�||��|d|dz
}t|�|jd	<||jd
<||_	d|_
|j|d|�y)a.Handle Range Request related headers (RFC7233).  If `Accept-Ranges`
        header is valid, and Range Request is processable, we set the headers
        as described by the RFC, and wrap the underlying response in a
        RangeWrapper.

        Returns ``True`` if Range Request can be fulfilled, ``False`` otherwise.

        :raises: :class:`~werkzeug.exceptions.RequestedRangeNotSatisfiable`
                 if `Range` header could not be parsed or satisfied.

        .. versionchanged:: 2.0
            Returns ``False`` if the length is 0.
        r)�RequestedRangeNotSatisfiablerFTr.r�rr_z
Accept-Rangesr�)�
exceptionsr�r�r
r��range_for_length�to_content_range_headerrr'�
content_ranger�r�)	r1rM�complete_length�
accept_rangesr��parsed_range�range_tuple�content_range_headerr�s	         r!�_process_range_requestzResponse._process_range_request�s���&	>���&��!�#��5�5�g�>���D� �#�M�)�'�+�+�l�*C�D����.��?�?�"�3�3�O�D��+�C�C�O�T����"6�">�.��?�?�$�Q��+�a�.�8��),�^�)<����%�&�(5����_�%�1�������!�!�+�a�.�.�A�r3c��t|�}|ddvr�d|jvrt�|jd<|j|||�}|sit	||jjd�d|jjd��s)t
|jd��rd	|_nd
|_|jr8d|jvr*|j�}|�t|�|jd<|S)
abMake the response conditional to the request.  This method works
        best if an etag was defined for the response already.  The `add_etag`
        method can be used to do that.  If called without etag just the date
        header is set.

        This does nothing if the request method in the request or environ is
        anything but GET or HEAD.

        For optimal performance when handling range requests, it's recommended
        that your response data object implements `seekable`, `seek` and `tell`
        methods as described by :py:class:`io.IOBase`.  Objects returned by
        :meth:`~werkzeug.wsgi.wrap_file` automatically implement those methods.

        It does not remove the body of the response because that's something
        the :meth:`__call__` function does for us automatically.

        Returns self so that you can do ``return resp.make_conditional(req)``
        but modifies the object in-place.

        :param request_or_environ: a request object or WSGI environment to be
                                   used to make the response conditional
                                   against.
        :param accept_ranges: This parameter dictates the value of
                              `Accept-Ranges` header. If ``False`` (default),
                              the header is not set. If ``True``, it will be set
                              to ``"bytes"``. If it's a string, it will use this
                              value.
        :param complete_length: Will be used only in valid Range Requests.
                                It will set `Content-Range` complete length
                                value and compute `Content-Length` real value.
                                This parameter is mandatory for successful
                                Range Requests completion.
        :raises: :class:`~werkzeug.exceptions.RequestedRangeNotSatisfiable`
                 if `Range` header could not be parsed or satisfied.

        .. versionchanged:: 2.0
            Range processing is skipped if length is 0 instead of
            raising a 416 Range Not Satisfiable error.
        r�)�GETr��date�Dater�Nr��
HTTP_IF_MATCHi�r�r�r_)rr'r
r�rr�rr�r`rnr)r1�request_or_environr�r�rM�is206r�s       r!�make_conditionalzResponse.make_conditional�s���Z�1�2���#�$��7�
�T�\�\�)�'0�{����V�$��/�/���-�X�E��!5����� � ��(����� � ��1�	"��w�{�{�?�;�<�'*�D�$�'*�D�$��5�5�$�D�L�L�8��6�6�8���%�58��[�D�L�L�!1�2��r3c�x�|sd|jvr*|jt|j��|�yy)z�Add an etag for the current response if there is none yet.

        .. versionchanged:: 2.0
            SHA-1 is used to generate the value. MD5 may not be
            available in some environments.
        r�N)r'�set_etagr	rW)r1�	overwrite�weaks   r!r�zResponse.add_etag
s0����d�l�l�2��M�M�-��
�
��8�$�?�3r3)NNNNNF)r$z8t.Iterable[bytes] | bytes | t.Iterable[str] | str | Noner&zint | str | HTTPStatus | Noner'zJt.Mapping[str, str | t.Iterable[str]] | t.Iterable[tuple[str, str]] | Noner(�
str | Noner)r�r,�bool�return�None)r7�t.Callable[[], t.Any]r�r��r�rr)r$rrMzWSGIEnvironment | Noner�r)F)rPrrMrrQr�r�r)rV�t.Literal[False]r�r.)rVzt.Literal[True]r�r)rVr�r��bytes | str)rbr�r�r�)r��
int | None)rsr�r�r��r�r�)r��t.Iterator[bytes]�r�r�)r�r)rMrr�r)rMrr��t.Iterable[bytes])rMrr�z4tuple[t.Iterable[bytes], str, list[tuple[str, str]]])rMrr�rr�r�)r��t.Any | None)..)r�r�r�r�r�zt.Any)r�r�r�r�r�r�)FF)r�r�)r��intr�r�r�r�)rMrr�r�)rMrr�r�r��
bool | strr�r�)FN)r�zWSGIEnvironment | Requestr�r�r�r�r�r)r�r�r�r�r�r�)-rD�
__module__�__qualname__�__doc__rqr�r`�__annotations__r+r8rF�classmethodrNrR�t�overloadrWr0�propertyr�rnrZrrrArBr=rurr�r�r�r�r�r�r�r�r�rr�r�r�r�r�r��
__classcell__)r2s@r!rr's����C�Z$(� �#(��(,�$�2�1�NR�04��#�#'�#(�!%�J�!%�.�!%��	!%��!%�!�!%�!�!%�
�!%�F	�F��CG�*��*�*@�*�	�*��*�X�NS�:�!�:�,;�:�GK�:�	�:��:�&�Z�Z�G��G��Z�Z�<��<��*=����L��D�8��2*�"	,��
��
��8��8�
����2P�d5�6=�&�=�	=�=�&�&��8E��	��$�K�
�����Z�Z�W��W��Z�Z�R��R��8�$��$�H�

&�1� �1�$�1�"�	1�

�1�l%*�&*�	G�5�G�"�G�$�	G�

�G�R@�@r3rc�^�eZdZdZdZdd�Zd
d�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zedd
��Z
y)r�z�A file descriptor like object used by :meth:`Response.stream` to
    represent the body of the stream. It directly pushes into the
    response iterable of the response object.
    zwb+c� �||_d|_y)NF)r$�closed)r1r$s  r!r+zResponseStream.__init__s�� ��
���r3c��|jrtd��|jjd��|jjj	|�|jj
j
dd�t|�S)N�I/O operation on closed fileT)rsr_)r�r�r$rZr5r'�popr@ras  r!�writezResponseStream.write!sg���;�;��;�<�<��
�
�&�&�t�&�4��
�
���%�%�e�,��
�
���!�!�"2�D�9��5�z�r3c�4�|D]}|j|��yr)r�)r1�seqr s   r!�
writelineszResponseStream.writelines)s���D��J�J�t��r3c��d|_y)NT)r�rms r!ruzResponseStream.close-s	����r3c�2�|jrtd��y)Nr��r�r�rms r!�flushzResponseStream.flush0s���;�;��;�<�<�r3c�2�|jrtd��y)Nr�Frrms r!�isattyzResponseStream.isatty4s���;�;��;�<�<�r3c��|jj�ttt|jj��Sr)r$rZr>r?r@rms r!�tellzResponseStream.tell9s.���
�
�&�&�(��3�s�D�M�M�2�2�3�4�4r3c��y)Nzutf-8rTrms r!�encodingzResponseStream.encoding=s��r3N)r$r)rbr.r�r�)r�r�r�r�r�r�)r�r�r�)rDr�r�r��moder+r�rrurrrr�r
rTr3r!r�r�sE���
�D�����=��
5����r3r�)rzt.Iterable[str | bytes]r�r�)'�
__future__rr��typingr��httpr�urllib.parser�	_internalr�datastructuresrr	r
rrr
r�sansio.responser�_SansIOResponse�urlsr�utilsr�wsgirrr�
TYPE_CHECKING�_typeshed.wsgirrr�requestrr"r�rTr3r!�<module>rsq��"���� �$�$� ��'��%�(�9��#� �"�"��?�?�,�.�.� ��k@��k@�\*�*r3

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