
    %[fZ                    d   d dl mZ d dl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
 ej        r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  G d de          Z G d dee          Z G d de          Z G d de          Z G d dee          Z G d de          Z G d de          ZdS )    )annotationsN   )
BadRequest)HTTPException)cached_property)redirect)WSGIEnvironment   )
MapAdapter)Rule)Request)Responsec                      e Zd ZdZdS )RoutingExceptionzxSpecial exceptions that require the application to redirect, notifying
    about missing urls, etc.

    :internal:
    N__name__
__module____qualname____doc__     O/var/www/piapp/venv/lib/python3.11/site-packages/werkzeug/routing/exceptions.pyr   r      s           r   r   c                  6     e Zd ZdZdZd fdZ	 	 dddZ xZS )RequestRedirectzRaise if the map requests a redirect. This is for example the case if
    `strict_slashes` are activated and an url that requires a trailing slash.

    The attribute `new_url` contains the absolute destination url.
    i4  new_urlstrreturnNonec                X    t                                          |           || _        d S N)super__init__r   )selfr   	__class__s     r   r"   zRequestRedirect.__init__$   s&    !!!r   Nenviron WSGIEnvironment | Request | Nonescopedict | Noner   c                6    t          | j        | j                  S r    )r   r   code)r#   r%   r'   s      r   get_responsezRequestRedirect.get_response(   s    
 di000r   )r   r   r   r   )NN)r%   r&   r'   r(   r   r   )r   r   r   r   r*   r"   r+   __classcell__r$   s   @r   r   r      so          D      59!1 1 1 1 1 1 1 1 1r   r   c                  (     e Zd ZdZdZd fdZ xZS )	RequestPathzInternal exception.)	path_infor0   r   r   r   c                V    t                                                       || _        d S r    )r!   r"   r0   )r#   r0   r$   s     r   r"   zRequestPath.__init__5   s$    "r   )r0   r   r   r   )r   r   r   r   	__slots__r"   r,   r-   s   @r   r/   r/   0   sH        I# # # # # # # # # #r   r/   c                  $     e Zd ZdZd	 fdZ xZS )
RequestAliasRedirectzAThis rule is an alias and wants to redirect to the canonical URL.matched_valuest.Mapping[str, t.Any]endpointr   r   r   c                d    t                                                       || _        || _        d S r    )r!   r"   r5   r7   )r#   r5   r7   r$   s      r   r"   zRequestAliasRedirect.__init__=   s,    , r   )r5   r6   r7   r   r   r   )r   r   r   r   r"   r,   r-   s   @r   r4   r4   :   sC        KK! ! ! ! ! ! ! ! ! !r   r4   c                  P     e Zd ZdZ	 dd fdZedd            ZddZddZ xZ	S )
BuildErrorz_Raised if the build system cannot find a URL for an endpoint with the
    values provided.
    Nr7   r   valuesr6   method
str | NoneadapterMapAdapter | Noner   r   c                    t                                          |||           || _        || _        || _        || _        d S r    )r!   r"   r7   r;   r<   r>   )r#   r7   r;   r<   r>   r$   s        r   r"   zBuildError.__init__H   sA     	66222 r   Rule | Nonec                6    |                      | j                  S r    )closest_ruler>   )r#   s    r   	suggestedzBuildError.suggestedU   s      ...r   c                f     d fd}|r'|j         j        rt          |j         j        |          S d S )Nruler   r   floatc           	     L   t          dt          j        d | j        j                                                  z  dt          t          j        pd                              | j	                            z  dt          | j
        oj        | j
        v           z  g          S )Ng\(\?g{Gz?r   )sumdifflibSequenceMatcherr7   ratioboolsetr;   issubset	argumentsmethodsr<   )rF   r#   s    r   _score_rulez,BuildError.closest_rule.<locals>._score_ruleZ   s    -dmT] egg 4DK$52 6 6 ? ? O OPPP4 L1LMMM	 	 	r   )key)rF   r   r   rG   )map_rulesmax)r#   r>   rR   s   `  r   rC   zBuildError.closest_ruleY   sT    
	 
	 
	 
	 
	 
	  	<w{) 	<w{){;;;;tr   c                T   d| j         g}| j        r|                    d| j        d           | j        r*|                    dt	          | j                             |                    d           | j        r| j         | j        j         k    r| j        rO| j        j        C| j        | j        j        vr0|                    dt	          | j        j                  d           | j        j                            t          | j        j
        pd                    t          | j                                                  z
  }|r&|                    d	t	          |          d           n#|                    d
| j        j         d           d                    |          S )Nz!Could not build url for endpoint z ()z with values .z Did you mean to use methods ?r   z" Did you forget to specify values z Did you mean z	 instead? )r7   r<   appendr;   sortedrD   rQ   rP   unionrN   defaultskeysjoin)r#   messagemissing_valuess      r   __str__zBuildError.__str__k   s   Ht}HHI; 	2NN0000111; 	DNNB6$++>+>BBCCCs> 	V} 777K.:4>+AAANN@"4>#9::@ @ @   "&!9!?!?/5266" "((**++", " NNXVN=S=SXXX   T0GTTTUUUwwwr   r    )
r7   r   r;   r6   r<   r=   r>   r?   r   r   )r   rA   )r>   r?   r   rA   )r   r   )
r   r   r   r   r"   r   rD   rC   rd   r,   r-   s   @r   r:   r:   C   s          &*       / / / _/   $               r   r:   c                      e Zd ZdZdS )WebsocketMismatchzThe only matched rule is either a WebSocket and the request is
    HTTP, or the rule is HTTP and the request is a WebSocket.
    Nr   r   r   r   rf   rf      s           r   rf   c                      e Zd ZdZd
dZd	S )NoMatchhave_match_forwebsocket_mismatchrj   set[str]rk   rM   r   r   c                "    || _         || _        d S r    ri   )r#   rj   rk   s      r   r"   zNoMatch.__init__   s    ,"4r   N)rj   rl   rk   rM   r   r   )r   r   r   r2   r"   r   r   r   rh   rh      s-        8I5 5 5 5 5 5r   rh   )
__future__r   rJ   typingt
exceptionsr   r   utilsr   r   TYPE_CHECKING_typeshed.wsgir	   rT   r   rulesr   wrappers.requestr   wrappers.responser   	Exceptionr   r   r/   r4   LookupErrorr:   rf   rh   r   r   r   <module>rz      s   " " " " " "      # # # # # # & & & & & & # # # # # #      ? -......******,,,,,,    y   1 1 1 1 1m%5 1 1 1*# # # # #" # # #! ! ! ! !+ ! ! !C  C  C  C  C !; C  C  C L    
   5 5 5 5 5i 5 5 5 5 5r   