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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
U
Þ=®d0}ã@sÀddlmZddlZddlZddlZddlmZddlm    Z    ddl
m Z ddl m Z ddlmZdd    lmZd
d lmZejr–d
d lmZd
d lmZGdd„dejƒZeGdd„dƒƒZe dej¡Ze d¡Ze dej¡ZddddœZ dddddœdd„Z!dddœdd „Z"dd!d"œd#d$„Z#Gd%d&„d&ƒZ$Gd'd(„d(e$ƒZ%Gd)d*„d*e$ƒZ&Gd+d,„d,e$ƒZ'Gd-d.„d.ƒZ(Gd/d0„d0e$ƒZ)dd1d2œd3d4„Z*d5Z+d6Z,e*e,ƒZ-e*d7ƒe*d8ƒfZ.Gd9d:„d:e$ƒZ/dS);é)Ú annotationsN)Ú    dataclass)ÚTemplate)ÚCodeType)Úquoteé)Úiter_multi_items)Ú
_urlencodeé)ÚValidationError)Ú BaseConverter)ÚMapc@s.eZdZUded<ded<ded<ded<dS)    Ú    WeightingÚintZnumber_static_weightszlist[tuple[int, int]]Ústatic_weightsZnumber_argument_weightsz    list[int]Úargument_weightsN)Ú__name__Ú
__module__Ú __qualname__Ú__annotations__©rrúMd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\werkzeug/routing/rules.pyrs
rc@s:eZdZUdZded<ded<ded<ded<ded    <d
S) ÚRuleParta$A part of a rule.
 
    Rules can be represented by parts as delimited by `/` with
    instances of this class representing those parts. The *content* is
    either the raw content if *static* or a regex string to match
    against. The *weight* can be used to order parts when matching.
 
    ÚstrÚcontentÚboolÚfinalÚstaticÚsuffixedrÚweightN)rrrÚ__doc__rrrrrrs
    ra
    (?:
        (?P<slash>/)                                 # a slash
      |
        (?P<static>[^</]+)                           # static rule data
      |
        (?:
          <
            (?:
              (?P<converter>[a-zA-Z_][a-zA-Z0-9_]*)   # converter name
              (?:\((?P<arguments>.*?)\))?             # converter arguments
              :                                       # variable delimiter
            )?
            (?P<variable>[a-zA-Z_][a-zA-Z0-9_]*)      # variable name
           >
        )
    )
    z    <([^>]+)>z¼
    ((?P<name>\w+)\s*=\s*)?
    (?P<value>
        True|False|
        \d+.\d+|
        \d+.|
        \d+|
        [\w\d_.]+|
        [urUR]?(?P<stringval>"[^"]*?"|'[^']*')
    )\s*,
    TF)ÚNoneÚTrueÚFalserr)ÚvalueÚtargetÚposÚreturncCs0z| ||¡WStk
r*t|ƒYSXdS)zgFind the *target* in *value* after *pos*.
 
    Returns the *value* length if *target* isn't found.
    N)ÚindexÚ
ValueErrorÚlen)r$r%r&rrrÚ_findWsr+zNone | bool | int | float | str)r$r'c    Csz|tkrt|SttfD](}z||ƒWStk
r>YqXq|dd…|dd…krr|ddkrr|dd…}t|ƒS)Nr
éÿÿÿÿrz"')Ú_PYTHON_CONSTANTSrÚfloatr)r)r$ÚconvertrrrÚ
_pythonizebs $ r0z tuple[t.Tuple, dict[str, t.Any]])Úargstrr'cCsx|d7}g}i}t |¡D]P}| d¡}|dkr:| d¡}t|ƒ}| d¡sX| |¡q| d¡}|||<qt|ƒ|fS)Nú,Z    stringvalr$Úname)Ú_converter_args_reÚfinditerÚgroupr0ÚappendÚtuple)r1ÚargsÚkwargsÚitemr$r3rrrÚparse_converter_argsos
 
 
 
 
r<c@s eZdZdZdddœdd„ZdS)Ú RuleFactoryzâAs soon as you have more complex URL setups it's a good idea to use rule
    factories to avoid repetitive tasks.  Some of them are builtin, others can
    be added by subclassing `RuleFactory` and overriding `get_rules`.
    r út.Iterable[Rule]©Úmapr'cCs
tƒ‚dS)zaSubclasses of `RuleFactory` have to override this method and return
        an iterable of rules.N)ÚNotImplementedError©Úselfr@rrrÚ    get_rulesˆszRuleFactory.get_rulesN)rrrr rDrrrrr=‚sr=c@s2eZdZdZddddœdd„Zdd    d
œd d „Zd S)Ú    Subdomaina˜All URLs provided by this factory have the subdomain set to a
    specific domain. For example if you want to use the subdomain for
    the current language this can be a good setup::
 
        url_map = Map([
            Rule('/', endpoint='#select_language'),
            Subdomain('<string(length=2):lang_code>', [
                Rule('/', endpoint='index'),
                Rule('/about', endpoint='about'),
                Rule('/help', endpoint='help')
            ])
        ])
 
    All the rules except for the ``'#select_language'`` endpoint will now
    listen on a two letter long subdomain that holds the language code
    for the current request.
    rút.Iterable[RuleFactory]r!)Ú    subdomainÚrulesr'cCs||_||_dS©N)rGrH)rCrGrHrrrÚ__init__¡szSubdomain.__init__r út.Iterator[Rule]r?ccs6|jD]*}| |¡D]}| ¡}|j|_|VqqdSrI)rHrDÚemptyrG©rCr@Ú rulefactoryÚrulerrrrD¥s
 
zSubdomain.get_rulesN©rrrr rJrDrrrrrEŽsrEc@s2eZdZdZddddœdd„Zdd    d
œd d „Zd S)ÚSubmounta}Like `Subdomain` but prefixes the URL rule with a given string::
 
        url_map = Map([
            Rule('/', endpoint='index'),
            Submount('/blog', [
                Rule('/', endpoint='blog/index'),
                Rule('/entry/<entry_slug>', endpoint='blog/show')
            ])
        ])
 
    Now the rule ``'blog/show'`` matches ``/blog/entry/<entry_slug>``.
    rrFr!)ÚpathrHr'cCs| d¡|_||_dS)Nú/)ÚrstriprRrH)rCrRrHrrrrJ»s zSubmount.__init__r rKr?ccs<|jD]0}| |¡D] }| ¡}|j|j|_|VqqdSrI)rHrDrLrRrOrMrrrrD¿s
 
zSubmount.get_rulesNrPrrrrrQ­s rQc@s2eZdZdZddddœdd„Zdd    d
œd d „Zd S)ÚEndpointPrefixaˆPrefixes all endpoints (which must be strings for this factory) with
    another string. This can be useful for sub applications::
 
        url_map = Map([
            Rule('/', endpoint='index'),
            EndpointPrefix('blog/', [Submount('/blog', [
                Rule('/', endpoint='index'),
                Rule('/entry/<entry_slug>', endpoint='show')
            ])])
        ])
    rrFr!)ÚprefixrHr'cCs||_||_dSrI)rVrH)rCrVrHrrrrJÔszEndpointPrefix.__init__r rKr?ccs<|jD]0}| |¡D] }| ¡}|j|j|_|VqqdSrI)rHrDrLrVÚendpointrMrrrrDØs
 
zEndpointPrefix.get_rulesNrPrrrrrUÇs rUc@s2eZdZdZdddœdd„Zdddd    œd
d „Zd S) Ú RuleTemplateaXReturns copies of the rules wrapped and expands string templates in
    the endpoint, rule, defaults or subdomain sections.
 
    Here a small example for such a rule template::
 
        from werkzeug.routing import Map, Rule, RuleTemplate
 
        resource = RuleTemplate([
            Rule('/$name/', endpoint='$name.list'),
            Rule('/$name/<int:id>', endpoint='$name.show')
        ])
 
        url_map = Map([resource(name='user'), resource(name='page')])
 
    When a rule template is called the keyword arguments are used to
    replace the placeholders in all the string parameters.
    r>r!)rHr'cCst|ƒ|_dSrI)ÚlistrH)rCrHrrrrJószRuleTemplate.__init__zt.AnyÚRuleTemplateFactory)r9r:r'cOst|jt||ŽƒSrI)rZrHÚdict)rCr9r:rrrÚ__call__öszRuleTemplate.__call__N)rrrr rJr\rrrrrXàsrXc@s2eZdZdZddddœdd„Zdd    d
œd d „Zd S)rZzsA factory that fills in template variables into rules.  Used by
    `RuleTemplate` internally.
 
    :internal:
    rFzdict[str, t.Any]r!)rHÚcontextr'cCs||_||_dSrI)rHr])rCrHr]rrrrJszRuleTemplateFactory.__init__r rKr?c    
csÎ|jD]Â}| |¡D]²}d}}|jr`i}|j ¡D]*\}}t|tƒrVt|ƒ |j¡}|||<q4|j    dk    r|t|j    ƒ |j¡}|j
}t|tƒrœt|ƒ |j¡}t t|j ƒ |j¡|||j |j||jƒVqqdSrI)rHrDÚdefaultsÚitemsÚ
isinstancerrÚ
substituter]rGrWÚRulerOÚmethodsÚ
build_onlyÚstrict_slashes)    rCr@rNrOZ new_defaultsrGÚkeyr$Z new_endpointrrrrDs.
 
 
 
 
ùzRuleTemplateFactory.get_rulesNrPrrrrrZúsrZúast.stmt)Úsrcr'cCsPt |¡jd}t|tjƒr"|j}t |¡D]}t|tjƒr,d|j›|_q,|S)zEast parse and prefix names with `.` to avoid collision with user varsrÚ.)    ÚastÚparseÚbodyr`ZExprr$ÚwalkÚNameÚid)rhÚtreeÚnoderrrÚ _prefix_names!s  rrz#self._converters[{elem!r}].to_url()zpif kwargs:
    params = self._encode_query_vars(kwargs)
    q = "?" if params else ""
else:
    q = params = ""
ÚqÚparamsc@sheZdZdZdJddddddd    d    d
dddd d œ d d„Zddœdd„Zddœdd„Zdddœdd„Zd dœdd„ZdKddd dœdd„Z    ddddd d!œd"d#„Z
ddd$œd%d&„Z dd'd(œd)d*„Z d dœd+d,„Z ed-dd.d/œd0d1„ƒZdLdd.d3œd4d5„ZdMddd6d7œd8d9„Zddd(œd:d;„ZdNdddd<œd=d>„Zd?dœd@dA„ZdBddCœdDdE„ZdZddœdFdG„ZddœdHdI„ZdS)Orba£A Rule represents one URL pattern.  There are some options for `Rule`
    that change the way it behaves and are passed to the `Rule` constructor.
    Note that besides the rule-string all arguments *must* be keyword arguments
    in order to not break the application on Werkzeug upgrades.
 
    `string`
        Rule strings basically are just normal URL paths with placeholders in
        the format ``<converter(arguments):name>`` where the converter and the
        arguments are optional.  If no converter is defined the `default`
        converter is used which means `string` in the normal configuration.
 
        URL rules that end with a slash are branch URLs, others are leaves.
        If you have `strict_slashes` enabled (which is the default), all
        branch URLs that are matched without a trailing slash will trigger a
        redirect to the same URL with the missing slash appended.
 
        The converters are defined on the `Map`.
 
    `endpoint`
        The endpoint for this rule. This can be anything. A reference to a
        function, a string, a number etc.  The preferred way is using a string
        because the endpoint is used for URL generation.
 
    `defaults`
        An optional dict with defaults for other rules with the same endpoint.
        This is a bit tricky but useful if you want to have unique URLs::
 
            url_map = Map([
                Rule('/all/', defaults={'page': 1}, endpoint='all_entries'),
                Rule('/all/page/<int:page>', endpoint='all_entries')
            ])
 
        If a user now visits ``http://example.com/all/page/1`` they will be
        redirected to ``http://example.com/all/``.  If `redirect_defaults` is
        disabled on the `Map` instance this will only affect the URL
        generation.
 
    `subdomain`
        The subdomain rule string for this rule. If not specified the rule
        only matches for the `default_subdomain` of the map.  If the map is
        not bound to a subdomain this feature is disabled.
 
        Can be useful if you want to have user profiles on different subdomains
        and all subdomains are forwarded to your application::
 
            url_map = Map([
                Rule('/', subdomain='<username>', endpoint='user/homepage'),
                Rule('/stats', subdomain='<username>', endpoint='user/stats')
            ])
 
    `methods`
        A sequence of http methods this rule applies to.  If not specified, all
        methods are allowed. For example this can be useful if you want different
        endpoints for `POST` and `GET`.  If methods are defined and the path
        matches but the method matched against is not in this list or in the
        list of another rule for that path the error raised is of the type
        `MethodNotAllowed` rather than `NotFound`.  If `GET` is present in the
        list of methods and `HEAD` is not, `HEAD` is added automatically.
 
    `strict_slashes`
        Override the `Map` setting for `strict_slashes` only for this rule. If
        not specified the `Map` setting is used.
 
    `merge_slashes`
        Override :attr:`Map.merge_slashes` for this rule.
 
    `build_only`
        Set this to True and the rule will never match but will create a URL
        that can be build. This is useful if you have resources on a subdomain
        or folder that are not handled by the WSGI application (like static data)
 
    `redirect_to`
        If given this must be either a string or callable.  In case of a
        callable it's called with the url adapter that triggered the match and
        the values of the URL as keyword arguments and has to return the target
        for the redirect, otherwise it has to be a string with placeholders in
        rule syntax::
 
            def foo_with_slug(adapter, id):
                # ask the database for the slug for the old id.  this of
                # course has nothing to do with werkzeug.
                return f'foo/{Foo.get_slug_for_id(id)}'
 
            url_map = Map([
                Rule('/foo/<slug>', endpoint='foo'),
                Rule('/some/old/url/<slug>', redirect_to='foo/<slug>'),
                Rule('/other/old/url/<int:id>', redirect_to=foo_with_slug)
            ])
 
        When the rule is matched the routing system will raise a
        `RequestRedirect` exception with the target for the redirect.
 
        Keep in mind that the URL will be joined against the URL root of the
        script so don't use a leading slash on the target URL unless you
        really mean root of that domain.
 
    `alias`
        If enabled this rule serves as an alias for another rule with the same
        endpoint and arguments.
 
    `host`
        If provided and the URL map has host matching enabled this can be
        used to provide a match rule for the whole host.  This also means
        that the subdomain feature is disabled.
 
    `websocket`
        If ``True``, this rule is only matches for WebSocket (``ws://``,
        ``wss://``) requests. By default, rules will only match for HTTP
        requests.
 
    .. versionchanged:: 2.1
        Percent-encoded newlines (``%0a``), which are decoded by WSGI
        servers, are considered when routing instead of terminating the
        match early.
 
    .. versionadded:: 1.0
        Added ``websocket``.
 
    .. versionadded:: 1.0
        Added ``merge_slashes``.
 
    .. versionadded:: 0.7
        Added ``alias`` and ``host``.
 
    .. versionchanged:: 0.6.1
       ``HEAD`` is added to ``methods`` if ``GET`` is present.
    NFrzt.Mapping[str, t.Any] | Nonez
str | Nonezt.Iterable[str] | Nonerz bool | Nonez!str | t.Callable[..., str] | Noner!) Ústringr^rGrcrdrWreÚ merge_slashesÚ redirect_toÚaliasÚhostÚ    websocketr'c Cs
| d¡stdƒ‚||_| d¡ |_| d¡|_d|_||_||_||_    | |_
||_ ||_ |
|_ | |_|dk    rÄt|tƒr‚tdƒ‚dd„|Dƒ}d|krªd|krª| d¡| rÄ|dddhrÄtd    ƒ‚||_||_|    |_|rìttt|ƒƒ|_ntƒ|_i|_g|_g|_dS)
NrSz$urls must start with a leading slashz&'methods' should be a list of strings.cSsh|] }| ¡’qSr)Úupper)Ú.0ÚxrrrÚ    <setcomp>Üsz Rule.__init__.<locals>.<setcomp>ÚHEADÚGETÚOPTIONSzBWebSocket rules can only use 'GET', 'HEAD', and 'OPTIONS' methods.)Ú
startswithr)rOÚendswithZis_leafÚ    is_branchr@rervrGryr^rdrxrzr`rÚ    TypeErrorÚaddrcrWrwÚsetÚ    argumentsÚ _convertersÚ_traceÚ_parts) rCrur^rGrcrdrWrervrwrxryrzrrrrJ¹sB
 
 
ÿz Rule.__init__)r'cCst|ƒ|jf| ¡ŽS)zô
        Return an unbound copy of this rule.
 
        This can be useful if want to reuse an already bound URL for another
        map.  See ``get_empty_kwargs`` to override what keyword arguments are
        provided to the new copy.
        )ÚtyperOÚget_empty_kwargs©rCrrrrLósz
Rule.emptyzt.Mapping[str, t.Any]c Cs>d}|jrt|jƒ}t||j|j|j|j|j|j|j|j    d    S)a
        Provides kwargs for instantiating empty copy with empty()
 
        Use this method to provide custom keyword arguments to the subclass of
        ``Rule`` when calling ``some_rule.empty()``.  Helpful when the subclass
        has custom keyword arguments that are needed at instantiation.
 
        Must return a ``dict`` that will be provided as kwargs to the new
        instance of ``Rule``, following the initial ``self.rule`` value which
        is always provided as the first, required positional argument.
        N)    r^rGrcrdrWrerwrxry)
r^r[rGrcrdrWrerwrxry)rCr^rrrrýs 
÷zRule.get_empty_kwargsr rKr?ccs
|VdSrIrrBrrrrDszRule.get_rulescCs|j|jdddS)zqRebinds and refreshes the URL.  Call this if you modified the
        rule in place.
 
        :internal:
        T)ÚrebindN)Úbindr@rŽrrrÚrefreshsz Rule.refresh)r@rr'cCsl|jdk    r$|s$td|›d|j›ƒ‚||_|jdkr<|j|_|jdkrN|j|_|jdkr`|j|_| ¡dS)z§Bind the url to a map and create a regular expression based on
        the information from the rule itself and the defaults from the map.
 
        :internal:
        Nz    url rule z already bound to map )r@Ú RuntimeErrorrervrGZdefault_subdomainÚcompile)rCr@rrrrr#s
 
 
z    Rule.bindzt.Tupler )Ú variable_nameÚconverter_namer9r:r'cCs6||jjkrtd|›dƒ‚|jj||jf|ž|ŽS)zWLooks up the converter for the given parameter.
 
        .. versionadded:: 0.9
        zthe converter z does not exist)r@Ú
convertersÚ LookupError)rCr”r•r9r:rrrÚ get_converter4s zRule.get_converter)Ú
query_varsr'cCs0t|ƒ}|jjr t||jjd}t||jjdS)N)rf)Úencoding)rr@Zsort_parametersÚsortedÚsort_keyr    Úcharset)rCr™r_rrrÚ_encode_query_varsCszRule._encode_query_varszt.Iterable[RulePart])rOr'ccsvd}d}g}g}d}d}d}|t|ƒkrðt ||¡}    |    dkrLtd|›ƒ‚|     ¡}
|
ddk    r®| t|ƒt|
dƒ f¡|j d|
df¡||rž|
dn t |
d¡7}|
ddk    rh|rÊt |¡}d}t    |
dpÚdƒ\} } | 
|
d|
d    pöd
| | ¡} | |j |
d<|j   |
d¡| js(d}|d |›d | j›d 7}|d7}| | j¡|j d|
df¡|
ddk    ræ|j d¡|r’|d7}nT|s |d7}tt|ƒ |t|ƒ |ƒ}t|||d|dVd}d}g}g}d}d}|     ¡}qd}|r|ddkrd}|dd…d}|s*|d7}tt|ƒ |t|ƒ |ƒ}t|||||dV|rrtdddd|dVdS)NÚTFrzmalformed url rule: rÚvariablerˆÚ    converterÚdefaultz(?P<__werkzeug_ú>ú)r
Zslash)FrSrSz\Z©rrrrrr,z
(?<!/)(/?))r*Ú_part_reÚmatchr)Ú    groupdictr7rŠÚreÚescaper<r˜r‰rˆr†Zpart_isolatingÚregexrrrÚend)rCrOrrrrrZconvertor_numberr&r§ÚdataZc_argsZc_kwargsZconvobjrrrrrÚ _parse_ruleKs°  
 
ÿ  
üû
üûÿzRule._parse_rulec
Csì|jdk    stdƒ‚|jjr&|jp"d}n
|jp.d}g|_g|_i|_|dkrltddddt    dgdgƒdg|_n|j 
|  |¡¡|j  d¡|j }|jr¦t d    d
|j ¡}|j 
|  |¡¡|| d¡ |d¡|_|| d¡ |d¡|_dS) z.Compiles the regular expression and stores it.Nzrule not boundrŸFTrr¥)Fú|z/{2,}?rS)r@ÚAssertionErrorZ host_matchingryrGr‹rŠr‰rrÚextendr®r7rOrvr©ÚsubÚ_compile_builderÚ__get__Ú_buildÚ_build_unknown)rCZ domain_rulerOrrrr“¨s4 
 ûÿ
 z Rule.compilerz t.Callable[..., tuple[str, str]])Úcoder3r'cCsi}i}t|||ƒ||SrI)Úexec)r·r3ZglobsZlocsrrrÚ_get_func_codeÊs zRule._get_func_codeT)Úappend_unknownr'c    sZ|jpi‰g}g}|}|jD]~\}}|dkr:||kr:|}q|rj|ˆkrj|j| ˆ|¡}| d|f¡q|sŒ| dt|d|jjdf¡q| d|f¡qdddœd    d
„‰d d d œ‡fdd„ }||ƒ}||ƒ}    |sÚg}
ntg}
|         t
¡d ddœdd„} |
 t   t   | |ƒ| |    ƒgt  ¡¡¡¡‡fdd„||Dƒ} dd„ˆDƒ} tdƒ}d|j›d|_|jj t  dd¡¡| | D]}|jj t  |d¡¡q|t  dd¡|j_| D]}|jj t  d¡¡q®|
|_t  d¡}|g|_t  |¡D]R}d|jkrd|_d|jkr|j|_d |jkr(d!|_d"|jkrì|j|_qìt|d#d$ƒ}| ||j¡S)%Nr¯Fz!$&'()*+,/:;=@)ÚsaferšTrrg)Úelemr'cSs,ttj|dƒ}t t|ƒt ¡¡g|_|S)N)r¼)rrÚ_CALL_CONVERTER_CODE_FMTÚformatrjrnrÚLoadr9)r¼ÚretrrrÚ_convertîsz'Rule._compile_builder.<locals>._convertzlist[tuple[bool, str]]z list[ast.AST])Úopsr'cs„‡fdd„|Dƒ}|p t d¡g}|dg}|dd…D]F}t|tjƒrtt|dtjƒrtt |dj|j¡|d<q8| |¡q8|S)Ncs&g|]\}}|rˆ|ƒnt |¡‘qSr)rjÚConstant©r|Ú
is_dynamicr¼©rÁrrÚ
<listcomp>ôsÿz9Rule._compile_builder.<locals>._parts.<locals>.<listcomp>rŸrr
r,)rjrÃr`r$r7)rÂÚpartsrÀÚprÆrrr‹ós
þ
 z%Rule._compile_builder.<locals>._partszast.AST)rÈr'cSst|ƒdkr|dSt |¡S)Nr
r)r*rjZ    JoinedStr)rÈrrrÚ_join
s z$Rule._compile_builder.<locals>._joincs g|]\}}|r|ˆkr|‘qSrrrÄ)r^rrrÇsþz)Rule._compile_builder.<locals>.<listcomp>cSsg|] }t|ƒ‘qSr)r)r|ÚkrrrrÇsz def _(): passz    <builder:r£z.selfz.kwargsrŸÚlinenor
Ú
end_linenoÚ
col_offsetrÚend_col_offsetz<werkzeug routing>r¸) r^rŠr‰Zto_urlr7rr@rÚ_IF_KWARGS_URL_ENCODE_ASTr±Ú_URL_ENCODE_AST_NAMESrjZReturnÚTupler¿rrrOr3r9ÚargÚkwargrÃrlrkrmÚ _attributesrÌrÍrÎrÏr“r¹)rCrºZdom_opsZurl_opsZoplrÅr­r‹Z    dom_partsZ    url_partsrlrÊZpargsZkargsZfunc_astrÓÚ_Úmodulerqr·r)rÁr^rr³Ñsp
 þÿ
 ÿ
þ 
      zRule._compile_builderztuple[str, str] | None)Úvaluesrºr'cCs@z$|r|jf|ŽWS|jf|ŽWSWntk
r:YdSXdS)zžAssembles the relative url for that rule and the subdomain.
        If building doesn't work for some reasons `None` is returned.
 
        :internal:
        N)r¶rµr )rCrØrºrrrÚbuild9s z
Rule.buildcCs2t|j o.|jo.|j|jko.||ko.|j|jkƒS)zNCheck if this rule has defaults for a given rule.
 
        :internal:
        )rrdr^rWrˆ)rCrOrrrÚprovides_defaults_forIsÿ
þý
ûzRule.provides_defaults_for)rØÚmethodr'cCs€|dk    r |jdk    r ||jkr dS|jp(d}|jD]}||kr0||kr0dSq0|r|| ¡D]"\}}||krX|||krXdSqXdS)z\Check if the dict of values has enough data for url generation.
 
        :internal:
        NFrT)rcr^rˆr_)rCrØrÛr^rfr$rrrÚ suitable_forVs 
ÿþý
 
zRule.suitable_forztuple[int, int, int]cCs(|jr
dndt|jƒ t|jp dƒ fS)z?The build compare key for sorting.
 
        :internal:
        r
rr)rxr*rˆr^rŽrrrÚbuild_compare_keywszRule.build_compare_keyÚobject)Úotherr'cCst|t|ƒƒo|j|jkSrI)r`rŒrŠ)rCrßrrrÚ__eq__~sz Rule.__eq__cCs|jSrI)rOrŽrrrÚ__str__ƒsz Rule.__str__cCs¨|jdkrdt|ƒj›dSg}|jD]*\}}|rF| d|›d¡q&| |¡q&d |¡ d¡}|jdk    r€dd |j¡›dnd}dt|ƒj›d    |›|›d
|j›dS) Nú<z  (unbound)>r£rŸr¯z (z, r¤ú z -> )    r@rŒrrŠr7ÚjoinÚlstriprcrW)rCrÈrÅr­rcrrrÚ__repr__†s
 "z Rule.__repr__) NNNFNNNNFNF)F)T)T)N)rrrr rJrLrrDr‘rr˜ržr®r“Ú staticmethodr¹r³rÙrÚrÜrÝràÚ__hash__rárærrrrrb8sJó(:
]"ÿiÿÿ!rb)0Ú
__future__rrjr©ÚtypingÚtZ dataclassesrrurÚtypesrÚ urllib.parserZdatastructuresrÚurlsr    r–r Ú TYPE_CHECKINGr r@r Ú
NamedTuplerrr“ÚVERBOSEr¦Z_simple_rule_rer4r-r+r0r<r=rErQrUrXrZrrr½Z_IF_KWARGS_URL_ENCODE_CODErÐrÑrbrrrrÚ<module>sR          í
 ô    '