
    E d                     X   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 )    N   )
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__     dC:\Users\ChattiNader\Documents\MyHotelMatch\api\dev\Lib\site-packages\werkzeug/routing/exceptions.pyr   r      s           r   r   c                        e Zd ZdZdZdeddf fdZ	 	 ddej        ej	        d                  d	ej        e
         dd
f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returnNc                 X    t                                          |           || _        d S N)super__init__r   )selfr   	__class__s     r   r   zRequestRedirect.__init__"   s&    !!!r   environ)r   r   scoper   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   )NN)r   r   r   r   r%   strr   tOptionalUniondictr&   __classcell__r!   s   @r   r   r      s          D        FJ"&1 1AG$@AB1 z$1 
	1 1 1 1 1 1 1 1r   r   c                   0     e Zd ZdZdZdeddf fdZ xZS )RequestPathzInternal exception.)	path_infor0   r   Nc                 V    t                                                       || _        d S r   )r   r   r0   )r    r0   r!   s     r   r   zRequestPath.__init__3   s$    "r   )r   r   r   r   	__slots__r'   r   r,   r-   s   @r   r/   r/   .   sV        I## #$ # # # # # # # # # #r   r/   c                   T     e Zd ZdZdej        eej        f         deddf fdZ xZ	S )RequestAliasRedirectzAThis rule is an alias and wants to redirect to the canonical URL.matched_valuesendpointr   Nc                 d    t                                                       || _        || _        d S r   )r   r   r5   r6   )r    r5   r6   r!   s      r   r   zRequestAliasRedirect.__init__;   s,    , r   )
r   r   r   r   r(   Mappingr'   Anyr   r,   r-   s   @r   r4   r4   8   sf        KK!qyae'< ! !PT ! ! ! ! ! ! ! ! ! !r   r4   c                       e Zd ZdZ	 ddedej        eej        f         dej        e         dej        d         ddf
 fd	Z	e
dej        d
         fd            Zdej        d         dej        d
         fdZdefdZ xZS )
BuildErrorz_Raised if the build system cannot find a URL for an endpoint with the
    values provided.
    Nr6   valuesmethodadapterr
   r   c                     t                                          |||           || _        || _        || _        || _        d S r   )r   r   r6   r<   r=   r>   )r    r6   r<   r=   r>   r!   s        r   r   zBuildError.__init__F   sA     	66222 r   r   c                 6    |                      | j                  S r   )closest_ruler>   )r    s    r   	suggestedzBuildError.suggestedS   s      ...r   c                 x     dddt           f fd}|r'|j        j        rt          |j        j        |          S d S )Nruler   r   c           	      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SequenceMatcherr6   ratioboolsetr<   issubset	argumentsmethodsr=   )rD   r    s    r   _score_rulez,BuildError.closest_rule.<locals>._score_ruleX   s    -dmT] egg 4DK$52 6 6 ? ? O OPPP4 L1LMMM	 	 	r   )key)floatmap_rulesmax)r    r>   rO   s   `  r   rA   zBuildError.closest_ruleW   sb    
	f 
	 
	 
	 
	 
	 
	 
	  	<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? )r6   r=   appendr<   sortedrB   rN   rM   unionrK   defaultskeysjoin)r    messagemissing_valuess      r   __str__zBuildError.__str__i   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   )r   r   r   r   r'   r(   r8   r9   r)   r   r   rB   rA   rb   r,   r-   s   @r   r;   r;   A   s         -1  	#qu*% 
3	
 L) 
      /1:f- / / / _/AJ|$< FAS    $                 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   rd   rd      s           r   rd   c                   <    e Zd ZdZdej        e         deddfdZdS )NoMatchhave_match_forwebsocket_mismatchrh   ri   r   Nc                 "    || _         || _        d S r   rg   )r    rh   ri   s      r   r   zNoMatch.__init__   s    ,"4r   )	r   r   r   r2   r(   Setr'   rJ   r   r   r   r   rf   rf      sI        8I5quSz 5t 5PT 5 5 5 5 5 5r   rf   )rG   typingr(   
exceptionsr   r   utilsr   r   TYPE_CHECKING_typeshed.wsgir   rR   r
   rulesr   wrappers.requestr   wrappers.responser   	Exceptionr   r   r/   r4   LookupErrorr;   rd   rf   r   r   r   <module>rv      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   