zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
U
Þ=®dZã@sddlmZddlZddlZddlmZddlmZddlm    Z    ddlm
Z
ej rŽddl m Z d    d
lmZd    d lmZdd lmZdd lmZGdd„deƒZGdd„deeƒZGdd„deƒZGdd„deƒZGdd„deeƒZGdd„deƒZGdd„deƒZdS)é)Ú annotationsNé)Ú
BadRequest)Ú HTTPException)Úcached_property)Úredirect)ÚWSGIEnvironmenté)Ú
MapAdapter)ÚRule)ÚRequest)ÚResponsec@seZdZdZdS)ÚRoutingExceptionzxSpecial exceptions that require the application to redirect, notifying
    about missing urls, etc.
 
    :internal:
    N©Ú__name__Ú
__module__Ú __qualname__Ú__doc__©rrúRd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\werkzeug/routing/exceptions.pyrsrcs@eZdZdZdZdddœ‡fdd„ Zdd    d
d d œd d„Z‡ZS)ÚRequestRedirectzÜRaise 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ÚstrÚNone)Únew_urlÚreturncstƒ |¡||_dS©N)ÚsuperÚ__init__r)Úselfr©Ú    __class__rrr$s zRequestRedirect.__init__Nz WSGIEnvironment | Request | Nonez dict | Noner )ÚenvironÚscopercCst|j|jƒSr)rrÚcode)rr!r"rrrÚ get_response(szRequestRedirect.get_response)NN)rrrrr#rr$Ú __classcell__rrrrrs ýrcs,eZdZdZdZdddœ‡fdd„ Z‡ZS)Ú RequestPathzInternal exception.)Ú    path_inforr)r'rcstƒ ¡||_dSr)rrr')rr'rrrr5s
zRequestPath.__init__)rrrrÚ    __slots__rr%rrrrr&0sr&cs*eZdZdZddddœ‡fdd„ Z‡ZS)ÚRequestAliasRedirectzAThis rule is an alias and wants to redirect to the canonical URL.út.Mapping[str, t.Any]rr)Úmatched_valuesÚendpointrcstƒ ¡||_||_dSr)rrr+r,)rr+r,rrrr=s
zRequestAliasRedirect.__init__)rrrrrr%rrrrr):sr)cs`eZdZdZdddddddœ‡fd    d
„ Zed d œd d„ƒZdd dœdd„Zdd œdd„Z‡Z    S)Ú
BuildErrorz_Raised if the build system cannot find a URL for an endpoint with the
    values provided.
    Nrr*z
str | NonezMapAdapter | Noner)r,ÚvaluesÚmethodÚadapterrcs,tƒ |||¡||_||_||_||_dSr)rrr,r.r/r0)rr,r.r/r0rrrrHs
zBuildError.__init__z Rule | None)rcCs | |j¡Sr)Ú closest_ruler0©rrrrÚ    suggestedUszBuildError.suggested)r0rcs4dddœ‡fdd„ }|r0|jjr0t|jj|dSdS)Nr Úfloat)ÚrulercsTtdt d|jˆj¡ ¡dttˆjp(dƒ |j    ¡ƒdt|j
oJˆj |j
kƒgƒS)Ng\Âõ(\ï?g{®Gáz„?r) ÚsumÚdifflibZSequenceMatcherr,ZratioÚboolÚsetr.ÚissubsetÚ    argumentsÚmethodsr/)r5r2rrÚ _score_ruleZsÿÿúÿz,BuildError.closest_rule.<locals>._score_rule)Úkey)ÚmapZ_rulesÚmax)rr0r=rr2rr1Ys zBuildError.closest_rulecCsd|j›g}|jr(| d|j›d¡|jrD| dt|jƒ›¡| d¡|jrö|j|jjkrà|jrœ|jjdk    rœ|j|jjkrœ| dt|jjƒ›d¡|jj t    |jj
p°dƒ¡t    |j  ¡ƒ}|rö| d    t|ƒ›d¡n| d
|jj›d ¡d   |¡S) Nz!Could not build url for endpoint z (ú)z  with values Ú.z Did you mean to use methods ú?rz" Did you forget to specify values z Did you mean z     instead?Ú) r,r/Úappendr.Úsortedr3r<r;Úunionr9ÚdefaultsÚkeysÚjoin)rÚmessageZmissing_valuesrrrÚ__str__ks8
ÿ
þ ýÿÿ þÿzBuildError.__str__)N)
rrrrrrr3r1rLr%rrrrr-Cs    û r-c@seZdZdZdS)ÚWebsocketMismatchzThe only matched rule is either a WebSocket and the request is
    HTTP, or the rule is HTTP and the request is a WebSocket.
    NrrrrrrM‰srMc@s"eZdZdZddddœdd„ZdS)    ÚNoMatch©Úhave_match_forÚwebsocket_mismatchzset[str]r8r)rPrQrcCs||_||_dSrrO)rrPrQrrrr’szNoMatch.__init__N)rrrr(rrrrrrNsrN)Ú
__future__rr7ÚtypingÚtÚ
exceptionsrrÚutilsrrÚ TYPE_CHECKINGZ_typeshed.wsgirr?r
Úrulesr Zwrappers.requestr Zwrappers.responser Ú    Exceptionrrr&r)Ú LookupErrorr-rMrNrrrrÚ<module>s&          
    F