o
    ƒ±h¾$  ã                   @  sž   d dl mZ d dlZd dlmZ d dlmZ d dlmZ	 d dlm
Z ddlmZ dd	lmZ dd
lmZ ejr=d dlmZ G dd„ de	ƒZG dd„ deƒZ
dS )é    )ÚannotationsN)Ú
BadRequest)ÚHTTPException)ÚRequest)ÚResponseé   )Újson)Úcurrent_app)Ú_split_blueprint_path)ÚRulec                      s  e Zd ZU dZeZded< dZded< dZded< dZ	d	ed
< dZ
ded< dZded< dZded< ed)‡ fdd„ƒZejd*dd„ƒZed)‡ fdd„ƒZejd*dd„ƒZed)‡ fdd„ƒZejd*dd„ƒZed+dd„ƒZed+dd„ƒZed,d!d"„ƒZd-‡ fd#d$„Zd.‡ fd'd(„Z‡  ZS )/r   aÎ  The request object used by default in Flask.  Remembers the
    matched endpoint and view arguments.

    It is what ends up as :class:`~flask.request`.  If you want to replace
    the request object used you can subclass this and set
    :attr:`~flask.Flask.request_class` to your subclass.

    The request object is a :class:`~werkzeug.wrappers.Request` subclass and
    provides all of the attributes Werkzeug defines plus a few Flask
    specific ones.
    út.AnyÚjson_moduleNzRule | NoneÚurl_rulezdict[str, t.Any] | NoneÚ	view_argszHTTPException | NoneÚrouting_exceptionú
int | NoneÚ_max_content_lengthÚ_max_form_memory_sizeÚ_max_form_partsÚreturnc                   ó&   | j dur| j S tstƒ jS tjd S )a·  The maximum number of bytes that will be read during this request. If
        this limit is exceeded, a 413 :exc:`~werkzeug.exceptions.RequestEntityTooLarge`
        error is raised. If it is set to ``None``, no limit is enforced at the
        Flask application level. However, if it is ``None`` and the request has
        no ``Content-Length`` header and the WSGI server does not indicate that
        it terminates the stream, then no data is read to avoid an infinite
        stream.

        Each request defaults to the :data:`MAX_CONTENT_LENGTH` config, which
        defaults to ``None``. It can be set on a specific ``request`` to apply
        the limit to that specific view. This should be set appropriately based
        on an application's or view's specific needs.

        .. versionchanged:: 3.1
            This can be set per-request.

        .. versionchanged:: 0.6
            This is configurable through Flask config.
        NÚMAX_CONTENT_LENGTH)r   r	   ÚsuperÚmax_content_lengthÚconfig©Úself©Ú	__class__© úF/var/www/vip_panel/venv/lib/python3.10/site-packages/flask/wrappers.pyr   ;   s
   

zRequest.max_content_lengthÚvalueÚNonec                 C  ó
   || _ d S ©N)r   ©r   r!   r   r   r    r   X   ó   
c                   r   )a°  The maximum size in bytes any non-file form field may be in a
        ``multipart/form-data`` body. If this limit is exceeded, a 413
        :exc:`~werkzeug.exceptions.RequestEntityTooLarge` error is raised. If it
        is set to ``None``, no limit is enforced at the Flask application level.

        Each request defaults to the :data:`MAX_FORM_MEMORY_SIZE` config, which
        defaults to ``500_000``. It can be set on a specific ``request`` to
        apply the limit to that specific view. This should be set appropriately
        based on an application's or view's specific needs.

        .. versionchanged:: 3.1
            This is configurable through Flask config.
        NÚMAX_FORM_MEMORY_SIZE)r   r	   r   Úmax_form_memory_sizer   r   r   r   r    r(   \   ó
   

zRequest.max_form_memory_sizec                 C  r#   r$   )r   r%   r   r   r    r(   s   r&   c                   r   )a   The maximum number of fields that may be present in a
        ``multipart/form-data`` body. If this limit is exceeded, a 413
        :exc:`~werkzeug.exceptions.RequestEntityTooLarge` error is raised. If it
        is set to ``None``, no limit is enforced at the Flask application level.

        Each request defaults to the :data:`MAX_FORM_PARTS` config, which
        defaults to ``1_000``. It can be set on a specific ``request`` to apply
        the limit to that specific view. This should be set appropriately based
        on an application's or view's specific needs.

        .. versionchanged:: 3.1
            This is configurable through Flask config.
        NÚMAX_FORM_PARTS)r   r	   r   Úmax_form_partsr   r   r   r   r    r+   w   r)   zRequest.max_form_partsc                 C  r#   r$   )r   r%   r   r   r    r+   Ž   r&   ú
str | Nonec                 C  s   | j dur	| j jS dS )a  The endpoint that matched the request URL.

        This will be ``None`` if matching failed or has not been
        performed yet.

        This in combination with :attr:`view_args` can be used to
        reconstruct the same URL or a modified URL.
        N)r   Úendpointr   r   r   r    r-   ’   s   

zRequest.endpointc                 C  s(   | j }|durd|v r| d¡d S dS )aj  The registered name of the current blueprint.

        This will be ``None`` if the endpoint is not part of a
        blueprint, or if URL matching failed or has not been performed
        yet.

        This does not necessarily match the name the blueprint was
        created with. It may have been nested, or registered with a
        different name.
        NÚ.r   )r-   Ú
rpartition)r   r-   r   r   r    Ú	blueprint¡   s   zRequest.blueprintú	list[str]c                 C  s   | j }|du r	g S t|ƒS )zëThe registered names of the current blueprint upwards through
        parent blueprints.

        This will be an empty list if there is no current blueprint, or
        if URL matching failed.

        .. versionadded:: 2.0.1
        N)r0   r
   )r   Únamer   r   r    Ú
blueprints´   s   
zRequest.blueprintsc                   sL   t ƒ  ¡  trtjr | jdkr"| js$ddlm} || ƒ d S d S d S d S d S )Nzmultipart/form-datar   )Úattach_enctype_error_multidict)r   Ú_load_form_datar	   ÚdebugÚmimetypeÚfilesÚdebughelpersr4   )r   r4   r   r   r    r5   Å   s   
ÿþ
ÿøzRequest._load_form_dataÚeúValueError | Nonec              
     s<   zt ƒ  |¡W S  ty } z
trtjr‚ tƒ |‚d }~ww r$   )r   Úon_json_loading_failedr   r	   r6   )r   r:   Úebrr   r   r    r<   Ô   s   
€üzRequest.on_json_loading_failed)r   r   )r!   r   r   r"   )r   r,   )r   r1   )r   r"   )r:   r;   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ú__annotations__r   r   r   r   r   r   Úpropertyr   Úsetterr(   r+   r-   r0   r3   r5   r<   Ú__classcell__r   r   r   r    r      s:   
 r   c                      s<   e Zd ZU dZdZded< eZdZe	d
‡ fdd	„ƒZ
‡  ZS )r   a¬  The response object that is used by default in Flask.  Works like the
    response object from Werkzeug but is set to have an HTML mimetype by
    default.  Quite often you don't have to create this object yourself because
    :meth:`~flask.Flask.make_response` will take care of that for you.

    If you want to replace the response object used you can subclass this and
    set :attr:`~flask.Flask.response_class` to your subclass.

    .. versionchanged:: 1.0
        JSON support is added to the response, like the request. This is useful
        when testing to get the test client response data as JSON.

    .. versionchanged:: 1.0

        Added :attr:`max_cookie_size`.
    z	text/htmlr,   Údefault_mimetypeFr   Úintc                   s   t rt jd S tƒ jS )zŸRead-only view of the :data:`MAX_COOKIE_SIZE` config key.

        See :attr:`~werkzeug.wrappers.Response.max_cookie_size` in
        Werkzeug's docs.
        ÚMAX_COOKIE_SIZE)r	   r   r   Úmax_cookie_sizer   r   r   r    rI   ö   s   
zResponse.max_cookie_size)r   rG   )r>   r?   r@   rA   rF   rB   r   r   Úautocorrect_location_headerrC   rI   rE   r   r   r   r    r   Þ   s   
 r   )Ú
__future__r   ÚtypingÚtÚwerkzeug.exceptionsr   r   Úwerkzeug.wrappersr   ÚRequestBaser   ÚResponseBaseÚ r   Úglobalsr	   Úhelpersr
   ÚTYPE_CHECKINGÚwerkzeug.routingr   r   r   r   r    Ú<module>   s     M