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
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
U
Þ=®dH¾ãA@s@ddlmZddlZddlZddlZddlZddlm    Z    ddlmZddlm
Z
ddlm Z ddlm Z ddl mZdd    lmZdd
l
mZdd l
mZdd lmZdd lmZddlmZddlmZddlmZddlmZejròddlmZe dƒZ!e "d¡Z#e ddddddddddg
ƒZ$e d d!d"d#d$d%d&d'gƒZ%d(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhœ@Z&Gdidj„djeƒZ'Gdkdl„dleƒZ(ddndodpdqdrœdsdt„Z)ddqdudqdvœdwdx„Z*dodydqdzœd{d|„Z+dd}dudqd~œdd€„Z,ddqd‚œdƒd„„Z-dqd…d†œd‡dˆ„Z.ddqd‰dŠd‹œdŒd„Z/e "dŽej0ej1B¡Z2e "dej0ej1B¡Z3e "dej0¡Z4dod‘d†œd’d“„Z5ej6d”d•d–Z7ej8dod•d†œd—d˜„ƒZ9ej8dod™d”d‹œdšd˜„ƒZ9ddod›d”d‹œdœd˜„Z9ej6ddžd–Z:ej;ej<e:gdfZ=ej8ddodŸd d¡d¢œd£d¤„ƒZ>ej8dodŸd¥dd¢œd¦d¤„ƒZ>ddodŸd§dd¢œd¨d¤„Z>ej6d©dd–Z?ej;ej<e?gdfZ@ej8ddodªd dd¢œd«d¬„ƒZAej8dodªd­d©d¢œd®d¬„ƒZAddodªd¯d©d¢œd°d¬„ZAd dod±d²d³œd´dµ„ZBdod¶d†œd·d¸„ZCd!dod¹dºd³œd»d¼„ZDdod½d†œd¾d¿„ZEd"dodpdÀdÁœdÂdÄZFd#dodÄdÅd³œdÆdDŽZGd$dqdpdqdɜdÊd˄ZHdodÌd͜dÎdτZIdodÐd†œdÑd҄ZJdÓdqdԜdÕdքZKdod×d†œdØdلZLd%dÚdqdۜdÜd݄ZMd&dodÞd†œdßdà„ZNd'dádodâœdãdä„ZOd(dådodædçdpdpdèœdédê„ZPd)dìdíd dîœdïdð„ZQdìd dñœdòdó„ZRdqdpd‚œdôdõ„ZSdqdpd‚œdöd÷„ZTd*dødododùdúdûœdüdý„ZUe "dþejV¡ZWe "dÿejV¡ZXdddœZYeY Zdd„e[dƒde[ddƒ•Dƒ¡d+dqdqdád dododpdpdodpd dodqdœ dd„Z\ddddpdœdd„Z]ddl^m_Z`ddlambZcdS(,é)Ú annotationsN©Údate)Údatetime)Útime)Ú    timedelta)Útimezone)ÚEnum)Úsha1)Úmktime)Ú struct_time)Úquote)Úunquote)Úparse_http_listé)Ú
_dt_as_utc)Ú _plain_float)Ú
_plain_int)ÚWSGIEnvironmentzM!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~z&([Ww]/)?(?:"(.*?)"|(.*?))(?:\s*,\s*|$)Zallowzcontent-encodingzcontent-languagezcontent-lengthúcontent-locationz content-md5z content-rangez content-typeÚexpiresz last-modifiedÚ
connectionz
keep-alivezproxy-authenticatezproxy-authorizationÚteÚtrailerztransfer-encodingÚupgradeÚContinuezSwitching ProtocolsÚ
Processingz Early HintsÚOKÚCreatedÚAcceptedzNon Authoritative Informationz
No Contentz Reset ContentzPartial Contentz Multi StatuszAlready ReportedzIM UsedzMultiple ChoiceszMoved PermanentlyÚFoundz    See Otherz Not Modifiedz    Use Proxyz Switch ProxyzTemporary RedirectzPermanent Redirectz Bad RequestÚ UnauthorizedzPayment RequiredÚ    Forbiddenz    Not FoundzMethod Not AllowedzNot AcceptablezProxy Authentication RequiredzRequest TimeoutÚConflictÚGonezLength RequiredzPrecondition FailedzRequest Entity Too LargezRequest URI Too LongzUnsupported Media TypezRequested Range Not SatisfiablezExpectation Failedz I'm a teapotzMisdirected RequestzUnprocessable EntityÚLockedzFailed Dependencyz    Too EarlyzUpgrade RequiredzPrecondition RequiredzToo Many RequestszRequest Header Fields Too Largez
Retry WithzUnavailable For Legal ReasonszInternal Server ErrorzNot Implementedz Bad GatewayzService UnavailablezGateway TimeoutzHTTP Version Not SupportedzVariant Also NegotiateszInsufficient Storagez Loop Detectedz Not ExtendedzNetwork Authentication Failed)@édéeéfégéÈéÉéÊéËéÌéÍéÎéÏéÐéâi,i-i.i/i0i1i2i3i4ii‘i’i“i”i•i–i—i˜i™iši›iœiižiŸi i¡i¢i¥i¦i§i¨i©iªi¬i­i¯iÁiÃiôiõiöi÷iøiùiúiûiüiþiÿc@seZdZdZdZdZdS)ÚCOEPzCross Origin Embedder Policiesú unsafe-nonez require-corpN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú UNSAFE_NONEZ REQUIRE_CORP©r;r;úDd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\werkzeug/http.pyr4}sr4c@seZdZdZdZdZdZdS)ÚCOOPzCross Origin Opener Policiesr5zsame-origin-allow-popupsz same-originN)r6r7r8r9r:ZSAME_ORIGIN_ALLOW_POPUPSZ SAME_ORIGINr;r;r;r<r=„sr=Tzt.Anyz
str | NoneÚboolÚstr)ÚvalueÚ extra_charsÚ allow_tokenÚreturncCs’t|tƒr$tjdtdd| d¡}|dk    r<tjdtddt|ƒ}|sLdS|rrt}|rd|t|ƒO}|     |¡rr|S| 
dd    ¡ 
d
d ¡}d
|›d
S) aAdd double quotes around a header value. If the header contains only ASCII token
    characters, it will be returned unchanged. If the header contains ``"`` or ``\``
    characters, they will be escaped with an additional ``\`` character.
 
    This is the reverse of :func:`unquote_header_value`.
 
    :param value: The value to quote. Will be converted to a string.
    :param allow_token: Disable to quote the value even if it only has token characters.
 
    .. versionchanged:: 2.3
        The value is quoted if it is the empty string.
 
    .. versionchanged:: 2.3
        Passing bytes is deprecated and will not be supported in Werkzeug 3.0.
 
    .. versionchanged:: 2.3
        The ``extra_chars`` parameter is deprecated and will be removed in Werkzeug 3.0.
 
    .. versionadded:: 0.5
    úFPassing bytes is deprecated and will not be supported in Werkzeug 3.0.é©Ú
stacklevelÚlatin1NzNThe 'extra_chars' parameter is deprecated and will be removed in Werkzeug 3.0.z""ú\ú\\ú"ú\") Ú
isinstanceÚbytesÚwarningsÚwarnÚDeprecationWarningÚdecoder?Ú _token_charsÚsetÚ
issupersetÚreplace)r@rArBZ token_charsr;r;r<Úquote_header_valueŒs0
ý
ü 
rWz bool | None)r@Ú is_filenamerCcCsl|dk    rtjdtddt|ƒdkrh|d|dkr@dkrhnn$|dd…}|sh| d    d
¡ d d¡S|S) aBRemove double quotes and decode slash-escaped ``"`` and ``\`` characters in a
    header value.
 
    This is the reverse of :func:`quote_header_value`.
 
    :param value: The header value to unquote.
 
    .. versionchanged:: 2.3
        The ``is_filename`` parameter is deprecated and will be removed in Werkzeug 3.0.
    NzNThe 'is_filename' parameter is deprecated and will be removed in Werkzeug 3.0.rErFréÿÿÿÿrKrrJrIrL)rOrPrQÚlenrV)r@rXr;r;r<Úunquote_header_valueÇs ü, r[zt.Mapping[str, t.Any])ÚheaderÚoptionsrCcCsvg}|dk    r| |¡| ¡D]L\}}|dkr0q|ddkrR| |›d|›¡q| |›dt|ƒ›¡qd |¡S)aAProduce a header value and ``key=value`` parameters separated by semicolons
    ``;``. For example, the ``Content-Type`` header.
 
    .. code-block:: python
 
        dump_options_header("text/html", {"charset": "UTF-8"})
        'text/html; charset=UTF-8'
 
    This is the reverse of :func:`parse_options_header`.
 
    If a value contains non-token characters, it will be quoted.
 
    If a value is ``None``, the parameter is skipped.
 
    In some keys for some headers, a UTF-8 value can be encoded using a special
    ``key*=UTF-8''value`` form, where ``value`` is percent encoded. This function will
    not produce that format automatically, but if a given key ends with an asterisk
    ``*``, the value is assumed to have that form and will not be quoted further.
 
    :param header: The primary header value.
    :param options: Parameters to encode as ``key=value`` pairs.
 
    .. versionchanged:: 2.3
        Keys with ``None`` values are skipped rather than treated as a bare key.
 
    .. versionchanged:: 2.2.3
        If a key ends with ``*``, its value will not be quoted.
    NrYÚ*ú=ú; )ÚappendÚitemsrWÚjoin)r\r]ÚsegmentsÚkeyr@r;r;r<Údump_options_headerãs
 rfz$dict[str, t.Any] | t.Iterable[t.Any])ÚiterablerBrCc    s®ˆdk    rtjdtddnd‰t|tƒr’g}| ¡D]Z\}}|dkrP| |¡q4|ddkrr| |›d|›¡q4| |›dt|ˆd    ›¡q4n‡fd
d „|Dƒ}d  |¡S) aNProduce a header value from a list of items or ``key=value`` pairs, separated by
    commas ``,``.
 
    This is the reverse of :func:`parse_list_header`, :func:`parse_dict_header`, and
    :func:`parse_set_header`.
 
    If a value contains non-token characters, it will be quoted.
 
    If a value is ``None``, the key is output alone.
 
    In some keys for some headers, a UTF-8 value can be encoded using a special
    ``key*=UTF-8''value`` form, where ``value`` is percent encoded. This function will
    not produce that format automatically, but if a given key ends with an asterisk
    ``*``, the value is assumed to have that form and will not be quoted further.
 
    .. code-block:: python
 
        dump_header(["foo", "bar baz"])
        'foo, "bar baz"'
 
        dump_header({"foo": "bar baz"})
        'foo="bar baz"'
 
    :param iterable: The items to create a header from.
 
    .. versionchanged:: 2.3
        The ``allow_token`` parameter is deprecated and will be removed in Werkzeug 3.0.
 
    .. versionchanged:: 2.2.3
        If a key ends with ``*``, its value will not be quoted.
    NzO'The 'allow_token' parameter is deprecated and will be removed in Werkzeug 3.0.rErFTrYr^r_©rBcsg|]}t|ˆd‘qS)rh)rW©Ú.0Úxrhr;r<Ú
<listcomp>Kszdump_header.<locals>.<listcomp>z, )    rOrPrQrMÚdictrbrarWrc)rgrBrbrer@r;rhr<Ú dump_headers&#ü
  ÿrnzds.ContentSecurityPolicy)r\rCcCsd dd„| ¡Dƒ¡S)zäDump a Content Security Policy header.
 
    These are structured into policies such as "default-src 'self';
    script-src 'self'".
 
    .. versionadded:: 1.0.0
       Support for Content Security Policy headers was added.
 
    r`css |]\}}|›d|›VqdS)ú Nr;©rjrer@r;r;r<Ú    <genexpr>Zsz"dump_csp_header.<locals>.<genexpr>)rcrb©r\r;r;r<Údump_csp_headerPs
rsz    list[str])r@rCcCsXg}t|ƒD]F}t|ƒdkrH|d|dkr8dkrHnn |dd…}| |¡q |S)aØParse a header value that consists of a list of comma separated items according
    to `RFC 9110 <https://httpwg.org/specs/rfc9110.html#abnf.extension>`__.
 
    This extends :func:`urllib.request.parse_http_list` to remove surrounding quotes
    from values.
 
    .. code-block:: python
 
        parse_list_header('token, "quoted value"')
        ['token', 'quoted value']
 
    This is the reverse of :func:`dump_header`.
 
    :param value: The header value to parse.
    rErrYrKr)Ú_parse_list_headerrZra)r@ÚresultÚitemr;r;r<Úparse_list_header]s  ,  rwztype[dict] | Nonezdict[str, str])r@ÚclsrCcCs |dkrt}ntjdtdd|ƒ}t|tƒrHtjdtdd| d¡}t|ƒD]Ê}| d¡\}}}|     ¡}|szd||<qP|     ¡}d}|dd    krÔ|dd…}t
  |¡}|rÀ|  ¡\}}|  ¡}|d
krÔt||d }t|ƒdkr|d |dkrd krnn |dd…}|||<qP|S)aËParse a list header using :func:`parse_list_header`, then parse each item as a
    ``key=value`` pair.
 
    .. code-block:: python
 
        parse_dict_header('a=b, c="d, e", f')
        {"a": "b", "c": "d, e", "f": None}
 
    This is the reverse of :func:`dump_header`.
 
    If a key does not have a value, it is ``None``.
 
    This handles charsets for values as described in
    `RFC 2231 <https://www.rfc-editor.org/rfc/rfc2231#section-3>`__. Only ASCII, UTF-8,
    and ISO-8859-1 charsets are accepted, otherwise the value remains quoted.
 
    :param value: The header value to parse.
 
    .. versionchanged:: 2.3
        Added support for ``key*=charset''value`` encoded items.
 
    .. versionchanged:: 2.3
        Passing bytes is deprecated, support will be removed in Werkzeug 3.0.
 
    .. versionchanged:: 2.3
        The ``cls`` argument is deprecated and will be removed in Werkzeug 3.0.
 
    .. versionchanged:: 0.9
       The ``cls`` argument was added.
    NzFThe 'cls' parameter is deprecated and will be removed in Werkzeug 3.0.rErFz@Passing bytes is deprecated and will be removed in Werkzeug 3.0.rHr_rYr^>úutf-8Úasciiúus-asciiú
iso-8859-1©ÚencodingrrKr)rmrOrPrQrMrNrRrwÚ    partitionÚstripÚ_charset_value_reÚmatchÚgroupsÚlowerrrZ)r@rxrurvreZ    has_valuer~r‚r;r;r<Úparse_dict_headerxsFý
ý
 
  2 
r…aë
    # don't match multiple empty parts, that causes backtracking
    \s*;\s*  # find the part delimiter
    (?:
        ([\w!#$%&'*+\-.^`|~]+)  # key, one or more token chars
        =  # equals, with no space on either side
        (  # value, token or quoted string
            [\w!#$%&'*+\-.^`|~]+  # one or more token chars
        |
            "(?:\\\\|\\"|.)*?"  # quoted string, consuming slash escapes
        )
    )?  # optionally match key=value, to account for empty parts
    zÖ
    ([\w!#$%&*+\-.^`|~]*)'  # charset part, could be empty
    [\w!#$%&*+\-.^`|~]*'  # don't care about language part, usually empty
    ([\w!#$%&'*+\-.^`|~]+)  # one or more token chars with percent encoding
    z\*(\d+)$ztuple[str, dict[str, str]]c    Cs^|dkrdifS| d¡\}}}| ¡}| ¡}|r8|s@|ifSd|›}i}d}d}t |¡D]ô\}}|snq`| ¡}|ddkrÐ|dd…}t |¡}|r°| ¡\}}| ¡}|s¸|}|dkrÐ|}t||d}|d|dkrîd    krnn$|d
d…     d d ¡     d d    ¡     dd    ¡}t
  |¡}|rL|d|  ¡…}|  |d¡|||<q`|||<q`||fS)a­Parse a header that consists of a value with ``key=value`` parameters separated
    by semicolons ``;``. For example, the ``Content-Type`` header.
 
    .. code-block:: python
 
        parse_options_header("text/html; charset=UTF-8")
        ('text/html', {'charset': 'UTF-8'})
 
        parse_options_header("")
        ("", {})
 
    This is the reverse of :func:`dump_options_header`.
 
    This parses valid parameter parts as described in
    `RFC 9110 <https://httpwg.org/specs/rfc9110.html#parameter>`__. Invalid parts are
    skipped.
 
    This handles continuations and charsets as described in
    `RFC 2231 <https://www.rfc-editor.org/rfc/rfc2231#section-3>`__, although not as
    strictly as the RFC. Only ASCII, UTF-8, and ISO-8859-1 charsets are accepted,
    otherwise the value remains quoted.
 
    Clients may not be consistent in how they handle a quote character within a quoted
    value. The `HTML Standard <https://html.spec.whatwg.org/#multipart-form-data>`__
    replaces it with ``%22`` in multipart form data.
    `RFC 9110 <https://httpwg.org/specs/rfc9110.html#quoted.strings>`__ uses backslash
    escapes in HTTP headers. Both are decoded to the ``"`` character.
 
    Clients may not be consistent in how they handle non-ASCII characters. HTML
    documents must declare ``<meta charset=UTF-8>``, otherwise browsers may replace with
    HTML character references, which can be decoded using :func:`html.unescape`.
 
    :param value: The header value to parse.
    :return: ``(value, options)``, where ``options`` is a dict
 
    .. versionchanged:: 2.3
        Invalid parts, such as keys with no value, quoted keys, and incorrectly quoted
        values, are discarded instead of treating as ``None``.
 
    .. versionchanged:: 2.3
        Only ASCII, UTF-8, and ISO-8859-1 are accepted for charset values.
 
    .. versionchanged:: 2.3
        Escaped quotes in quoted values, like ``%22`` and ``\"``, are handled.
 
    .. versionchanged:: 2.2
        Option names are always converted to lowercase.
 
    .. versionchanged:: 2.2
        The ``multiple`` parameter was removed.
 
    .. versionchanged:: 0.15
        :rfc:`2231` parameter continuations are handled.
 
    .. versionadded:: 0.5
    NÚú;rYr^>ryrzr{r|r}rrKrrJrIrLz%22)rr€Ú _parameter_reÚfindallr„rr‚rƒrrVÚ_continuation_reÚsearchÚstartÚget)    r@Ú_Úrestr]r~Zcontinued_encodingÚpkÚpvr‚r;r;r<Úparse_options_headerísD9
 
  "$
 
r’Ú _TAnyAcceptz    ds.Accept)ÚboundcCsdS©Nr;)r@r;r;r<Úparse_accept_headerlsr–ztype[_TAnyAccept]cCsdSr•r;)r@rxr;r;r<r–qsztype[_TAnyAccept] | Nonec    Cs¶|dkrt tjttj¡}|s(|dƒSg}t|ƒD]x}t|ƒ\}}d|krŒzt|     d¡ƒ}Wnt
k
rvYq4YnX|dks4|dkrq4nd}|ržt ||ƒ}|  ||f¡q4||ƒS)akParse an ``Accept`` header according to
    `RFC 9110 <https://httpwg.org/specs/rfc9110.html#field.accept>`__.
 
    Returns an :class:`.Accept` instance, which can sort and inspect items based on
    their quality parameter. When parsing ``Accept-Charset``, ``Accept-Encoding``, or
    ``Accept-Language``, pass the appropriate :class:`.Accept` subclass.
 
    :param value: The header value to parse.
    :param cls: The :class:`.Accept` class to wrap the result in.
    :return: An instance of ``cls``.
 
    .. versionchanged:: 2.3
        Parse according to RFC 9110. Items with invalid ``q`` values are skipped.
    NÚqrr) ÚtÚcastÚTyper“ÚdsÚAcceptrwr’rÚpopÚ
ValueErrorrfra)r@rxrurvr]r—r;r;r<r–vs&  
 
Ú_TAnyCCzds.cache_control._CacheControlÚ _t_cc_updateÚNonezds.RequestCacheControl)r@Ú    on_updaterxrCcCsdSr•r;©r@r¢rxr;r;r<Úparse_cache_control_header­sr¤z type[_TAnyCC]cCsdSr•r;r£r;r;r<r¤´sztype[_TAnyCC] | NonecCs8|dkrt tjttj¡}|s*|d|ƒS|t|ƒ|ƒS)aParse a cache control header.  The RFC differs between response and
    request cache control, this method does not.  It's your responsibility
    to not use the wrong control statements.
 
    .. versionadded:: 0.5
       The `cls` was added.  If not specified an immutable
       :class:`~werkzeug.datastructures.RequestCacheControl` is returned.
 
    :param value: a cache control header to be parsed.
    :param on_update: an optional callable that is called every time a value
                      on the :class:`~werkzeug.datastructures.CacheControl`
                      object is changed.
    :param cls: the class for the returned object.  By default
                :class:`~werkzeug.datastructures.RequestCacheControl` is used.
    :return: a `cls` object.
    Nr;)r˜r™ršrŸr›ZRequestCacheControlr…r£r;r;r<r¤»s
 
Ú_TAnyCSPÚ _t_csp_updatecCsdSr•r;r£r;r;r<Úparse_csp_headerÝsr§ztype[_TAnyCSP]cCsdSr•r;r£r;r;r<r§äsztype[_TAnyCSP] | NonecCs†|dkrt tjttj¡}|dkr.|d|ƒSg}| d¡D]>}| ¡}d|kr<| ¡ dd¡\}}| | ¡| ¡f¡q<|||ƒS)aßParse a Content Security Policy header.
 
    .. versionadded:: 1.0.0
       Support for Content Security Policy headers was added.
 
    :param value: a csp header to be parsed.
    :param on_update: an optional callable that is called every time a value
                      on the object is changed.
    :param cls: the class for the returned object.  By default
                :class:`~werkzeug.datastructures.ContentSecurityPolicy` is used.
    :return: a `cls` object.
    Nr;r‡ror)    r˜r™ršr¥r›ZContentSecurityPolicyÚsplitr€ra)r@r¢rxrbÚpolicyÚ    directiver;r;r<r§ës
z't.Callable[[ds.HeaderSet], None] | Nonez ds.HeaderSet)r@r¢rCcCs |st d|¡St t|ƒ|¡S)aParse a set-like header and return a
    :class:`~werkzeug.datastructures.HeaderSet` object:
 
    >>> hs = parse_set_header('token, "quoted value"')
 
    The return value is an object that treats the items case-insensitively
    and keeps the order of the items:
 
    >>> 'TOKEN' in hs
    True
    >>> hs.index('quoted value')
    1
    >>> hs
    HeaderSet(['token', 'quoted value'])
 
    To create a header from the :class:`HeaderSet` again, use the
    :func:`dump_header` function.
 
    :param value: a set header to be parsed.
    :param on_update: an optional callable that is called every time a
                      value on the :class:`~werkzeug.datastructures.HeaderSet`
                      object is changed.
    :return: a :class:`~werkzeug.datastructures.HeaderSet`
    N)r›Z    HeaderSetrw)r@r¢r;r;r<Úparse_set_headers r«zds.Authorization | NonecCs&ddlm}tjdtdd| |¡S)aéParse an HTTP basic/digest authorization header transmitted by the web
    browser.  The return value is either `None` if the header was invalid or
    not given, otherwise an :class:`~werkzeug.datastructures.Authorization`
    object.
 
    :param value: the authorization header to parse.
    :return: a :class:`~werkzeug.datastructures.Authorization` object or `None`.
 
    .. deprecated:: 2.3
        Will be removed in Werkzeug 3.0. Use :meth:`.Authorization.from_header` instead.
    r)Ú Authorizationzx'parse_authorization_header' is deprecated and will be removed in Werkzeug 2.4. Use 'Authorization.from_header' instead.rErF)Údatastructuresr¬rOrPrQÚ from_header)r@r¬r;r;r<Úparse_authorization_header0s ür¯z-t.Callable[[ds.WWWAuthenticate], None] | Nonezds.WWWAuthenticatecCs@ddlm}tjdtdd| |¡}|dkr6|dƒ}||_|S)a0Parse an HTTP WWW-Authenticate header into a
    :class:`~werkzeug.datastructures.WWWAuthenticate` object.
 
    :param value: a WWW-Authenticate header to parse.
    :param on_update: an optional callable that is called every time a value
                      on the :class:`~werkzeug.datastructures.WWWAuthenticate`
                      object is changed.
    :return: a :class:`~werkzeug.datastructures.WWWAuthenticate` object.
 
    .. deprecated:: 2.3
        Will be removed in Werkzeug 3.0. Use :meth:`.WWWAuthenticate.from_header`
        instead.
    r)ÚWWWAuthenticatez}'parse_www_authenticate_header' is deprecated and will be removed in Werkzeug 2.4. Use 'WWWAuthenticate.from_header' instead.rErFNÚbasic)Zdatastructures.authr°rOrPrQr®Z
_on_update)r@r¢r°Úrvr;r;r<Úparse_www_authenticate_headerIs ü
r³z
ds.IfRangecCs:|s t ¡St|ƒ}|dk    r(tj|dSt t|ƒd¡S)zùParses an if-range header which can be an etag or a date.  Returns
    a :class:`~werkzeug.datastructures.IfRange` object.
 
    .. versionchanged:: 2.0
        If the value represents a datetime, it is timezone-aware.
 
    .. versionadded:: 0.7
    Nrr)r›ZIfRangeÚ
parse_dateÚ unquote_etag)r@rr;r;r<Úparse_if_range_headerks      r¶zds.Range | None)r@Úmake_inclusiverCc     Cs‚|r d|krdSg}d}| dd¡\}}| ¡ ¡}| d¡D]4}| ¡}d|krZdS| d¡r¢|dkrrdSz t|ƒ}Wntk
r–YdSXd}d}nÄd|krf| dd¡\}    }
|     ¡}    |
 ¡}
z t|    ƒ}Wntk
rðYdSX||ks|dkr dS|
rPzt|
ƒd}Wntk
r<YdSX||krTdSnd}|dk    rb|nd}| ||f¡q>t ||¡S)aParses a range header into a :class:`~werkzeug.datastructures.Range`
    object.  If the header is missing or malformed `None` is returned.
    `ranges` is a list of ``(start, stop)`` tuples where the ranges are
    non-inclusive.
 
    .. versionadded:: 0.7
    r_Nrrú,ú-rY)    r¨r€r„Ú
startswithrržrar›ZRange) r@r·ÚrangesZlast_endÚunitsÚrngrvÚbeginÚendZ    begin_strZend_strr;r;r<Úparse_range_header}sP
 
 
 
 
 
 
rÀz*t.Callable[[ds.ContentRange], None] | Nonezds.ContentRange | Nonec Cs.|dkr dSz|pd ¡ dd¡\}}Wntk
r>YdSXd|krLdS| dd¡\}}|dkrjd}n$z t|ƒ}Wntk
rŒYdSX|dkrºtdd|ƒs¦dStj|dd||dSd|krÆdS| dd¡\}}zt|ƒ}    t|ƒd}
Wntk
rYdSXt|    |
|ƒr*tj||    |
||dSdS)ašParses a range header into a
    :class:`~werkzeug.datastructures.ContentRange` object or `None` if
    parsing is not possible.
 
    .. versionadded:: 0.7
 
    :param value: a content range header to be parsed.
    :param on_update: an optional callable that is called every time a value
                      on the :class:`~werkzeug.datastructures.ContentRange`
                      object is changed.
    Nr†rú/r^)r¢r¹)r€r¨ržrÚis_byte_range_validr›Z ContentRange) r@r¢r¼Zrangedefr½Z
length_strÚlengthZ    start_strZstop_strrŒÚstopr;r;r<Úparse_content_range_header¸s<  rÅF)ÚetagÚweakrCcCs.d|krtdƒ‚d|›d}|r*d|›}|S)ziQuote an etag.
 
    :param etag: the etag to quote.
    :param weak: set to `True` to tag it "weak".
    rKz invalid etagúW/)rž©rÆrÇr;r;r<Ú
quote_etagîs  
rÊz&tuple[str, bool] | tuple[(None, None)])rÆrCcCsj|sdS| ¡}d}| d¡r.d}|dd…}|dd…|dd…krRd    krbnn |dd…}||fS)
zØUnquote a single etag:
 
    >>> unquote_etag('W/"bar"')
    ('bar', True)
    >>> unquote_etag('"bar"')
    ('bar', False)
 
    :param etag: the etag identifier to unquote.
    :return: a ``(etag, weak)`` tuple.
    )NNF)rÈzw/TrENrrYrK)r€rºrÉr;r;r<rµüs 
 ( rµzds.ETagsc    Cs˜|s t ¡Sg}g}t|ƒ}d}||krŒt ||¡}|dkr>qŒ| ¡\}}}|dkr`tjddS|rh|}|rx| |¡n
| |¡| ¡}q t ||¡S)z…Parse an etag header.
 
    :param value: the tag header to parse
    :return: an :class:`~werkzeug.datastructures.ETags` object.
    rNr^T)Zstar_tag)r›ZETagsrZÚ_etag_rer‚rƒrar¿)    r@ÚstrongrÇr¿Úposr‚Zis_weakÚquotedÚrawr;r;r<Ú parse_etagss(   
 
rÐrN)ÚdatarCcCs t|ƒ ¡S)zƒGenerate an etag for some data.
 
    .. versionchanged:: 2.0
        Use SHA-1. MD5 may not be available in some environments.
    )r
Ú    hexdigest)rÑr;r;r<Ú generate_etag2srÓzdatetime | Nonec    CsT|dkr dSztj |¡}Wnttfk
r6YdSX|jdkrP|jtjdS|S)aKParse an :rfc:`2822` date into a timezone-aware
    :class:`datetime.datetime` object, or ``None`` if parsing fails.
 
    This is a wrapper for :func:`email.utils.parsedate_to_datetime`. It
    returns ``None`` if parsing fails instead of raising an exception,
    and always returns a timezone-aware datetime object. If the string
    doesn't have timezone information, it is assumed to be UTC.
 
    :param value: A string with a supported date format.
 
    .. versionchanged:: 2.0
        Return a timezone-aware datetime object. Use
        ``email.utils.parsedate_to_datetime``.
    N©Útzinfo)    ÚemailÚutilsÚparsedate_to_datetimeÚ    TypeErrorržrÕrVrÚutc)r@Údtr;r;r<r´;s
r´z2datetime | date | int | float | struct_time | None)Ú    timestamprCcCsdt|tƒrBt|tƒs*tj|tƒtjd}nt|ƒ}tj    j
|ddSt|t ƒrTt |ƒ}tj    j |ddS)aªFormat a datetime object or timestamp into an :rfc:`2822` date
    string.
 
    This is a wrapper for :func:`email.utils.format_datetime`. It
    assumes naive datetime objects are in UTC instead of raising an
    exception.
 
    :param timestamp: The datetime or timestamp to format. Defaults to
        the current time.
 
    .. versionchanged:: 2.0
        Use ``email.utils.format_datetime``. Accept ``date`` objects.
    rÔT)Úusegmt)rMrrÚcombinerrrÚrrÖr×Úformat_datetimer r Ú
formatdate)rÜr;r;r<Ú    http_dateXs
 
 
ráztimedelta | NonecCs`|sdSz t|ƒ}Wntk
r*YdSX|dkr8dSz t|dWStk
rZYdSXdS)züParses a base-10 integer count of seconds into a timedelta.
 
    If parsing fails, the return value is `None`.
 
    :param value: a string consisting of an integer represented in base-10
    :return: a :class:`datetime.timedelta` object or `None`.
    Nr)Úseconds)ÚintržrÚ OverflowError)r@râr;r;r<Ú    parse_agexs  råztimedelta | int | None)ÚagerCcCsD|dkr dSt|tƒr$t| ¡ƒ}nt|ƒ}|dkr<tdƒ‚t|ƒS)zÛFormats the duration as a base-10 integer.
 
    :param age: should be an integer number of seconds,
                a :class:`datetime.timedelta` object, or,
                if the age is unknown, `None` (default).
    Nrzage cannot be negative)rMrrãÚ total_secondsržr?)rær;r;r<Údump_ageŽs
rèrz bytes | Nonezdatetime | str | None)ÚenvironrÆrÑÚ last_modifiedÚignore_if_rangerCc Cs:tj| d¡| d¡| d¡| d¡| d¡||||d    S)a2Convenience method for conditional requests.
 
    :param environ: the WSGI environment of the request to be checked.
    :param etag: the etag for the response for comparison.
    :param data: or alternatively the data of the response to automatically
                 generate an etag using :func:`generate_etag`.
    :param last_modified: an optional date of the last modification.
    :param ignore_if_range: If `False`, `If-Range` header will be taken into
                            account.
    :return: `True` if the resource was modified, otherwise `False`.
 
    .. versionchanged:: 2.0
        SHA-1 is used to generate an etag value for the data. MD5 may
        not be available in some environments.
 
    .. versionchanged:: 1.0.0
        The check is run for methods other than ``GET`` and ``HEAD``.
    Z
HTTP_RANGEZ HTTP_IF_RANGEZHTTP_IF_MODIFIED_SINCEZHTTP_IF_NONE_MATCHZ HTTP_IF_MATCH)    Z
http_rangeZ http_if_rangeZhttp_if_modified_sinceZhttp_if_none_matchZ http_if_matchrÆrÑrêrë)Ú _sansio_httpÚis_resource_modifiedr)rérÆrÑrêrër;r;r<rí¢s÷rí©rrz"ds.Headers | list[tuple[str, str]]zt.Iterable[str])ÚheadersÚallowedrCcs,dd„ˆDƒ‰‡fdd„|Dƒ|dd…<dS)aRemove all entity headers from a list or :class:`Headers` object.  This
    operation works in-place.  `Expires` and `Content-Location` headers are
    by default not removed.  The reason for this is :rfc:`2616` section
    10.3.5 which specifies some entity headers that should be sent.
 
    .. versionchanged:: 0.5
       added `allowed` parameter.
 
    :param headers: a list or :class:`Headers` object.
    :param allowed: a list of headers that should still be allowed even though
                    they are entity headers.
    cSsh|] }| ¡’qSr;)r„rir;r;r<Ú    <setcomp>Øsz(remove_entity_headers.<locals>.<setcomp>cs,g|]$\}}t|ƒr | ¡ˆkr||f‘qSr;)Úis_entity_headerr„rp©rðr;r<rlÙs þz)remove_entity_headers.<locals>.<listcomp>Nr;)rïrðr;rór<Úremove_entity_headersÈs
þrô)rïrCcCsdd„|Dƒ|dd…<dS)zÌRemove all HTTP/1.1 "Hop-by-Hop" headers from a list or
    :class:`Headers` object.  This operation works in-place.
 
    .. versionadded:: 0.5
 
    :param headers: a list or :class:`Headers` object.
    cSs g|]\}}t|ƒs||f‘qSr;)Úis_hop_by_hop_headerrpr;r;r<rlèsz-remove_hop_by_hop_headers.<locals>.<listcomp>Nr;)rïr;r;r<Úremove_hop_by_hop_headersàsÿröcCs | ¡tkS)z¯Check if a header is an entity header.
 
    .. versionadded:: 0.5
 
    :param header: the header to test.
    :return: `True` if it's an entity header, `False` otherwise.
    )r„Ú_entity_headersrrr;r;r<ròísròcCs | ¡tkS)zÍCheck if a header is an HTTP/1.1 "Hop-by-Hop" header.
 
    .. versionadded:: 0.5
 
    :param header: the header to test.
    :return: `True` if it's an HTTP/1.1 "Hop-by-Hop" header, `False` otherwise.
    )r„Ú_hop_by_hop_headersrrr;r;r<rõøsrõzWSGIEnvironment | str | Noneztype[ds.MultiDict] | Nonezds.MultiDict[str, str])r\ÚcharsetÚerrorsrxrCcCsbt|tƒr| d¡}n(t|tƒr:tjdtdd| ¡}n|}|rP| d¡ ¡}t    j
||||dS)a}Parse a cookie from a string or WSGI environ.
 
    The same key can be provided multiple times, the values are stored
    in-order. The default :class:`MultiDict` will have the first value
    first, and all values can be retrieved with
    :meth:`MultiDict.getlist`.
 
    :param header: The cookie header as a string, or a WSGI environ dict
        with a ``HTTP_COOKIE`` key.
    :param cls: A dict-like class to store the parsed cookies in.
        Defaults to :class:`MultiDict`.
 
    .. versionchanged:: 2.3
        Passing bytes, and the ``charset`` and ``errors`` parameters, are deprecated and
        will be removed in Werkzeug 3.0.
 
    .. versionchanged:: 1.0
        Returns a :class:`MultiDict` instead of a ``TypeConversionDict``.
 
    .. versionchanged:: 0.5
        Returns a :class:`TypeConversionDict` instead of a regular dict. The ``cls``
        parameter was added.
    Z HTTP_COOKIErDrErFrH)Úcookierùrúrx) rMrmrrNrOrPrQrRÚencoderìÚ parse_cookie)r\rùrúrxrûr;r;r<rýs$
 
ý
ÿrýz#[\w!#$%&'()*+\-./:<=>?@\[\]^`{|}~]*s[\x00-\x19\",;\\\x7f-\xff]s\"s\\)ó"ó\ccs"|]}| dd¡d|fVqdS)rÚbigs\%03oN)Úto_bytes)rjÚvr;r;r<rq7sÿrqé s,;éér†rÁéýz#str | datetime | int | float | Nonerã) rer@Úmax_agerÚpathÚdomainÚsecureÚhttponlyrùÚ sync_expiresÚmax_sizeÚsamesiterCc  CsD|dk    rtjdtddnd}t|tƒr@tjdtdd| ¡}t|tƒrbtjdtdd| ¡}|dk    rxt|d|d    }|rœ| d
¡d  d ¡     d ¡ d¡}t|t
ƒr²t |  ¡ƒ}|dk    rÎt|t ƒsôt|ƒ}n&|dk    rô|    rôttjtjd ¡|ƒ}| dk    r|  ¡} | dkrtdƒ‚t |¡sLt dd„|     |¡¡ d¡}d|›d}|     ¡ d¡›d|›g} d|fd|fd|fd|fd|fd|fd| ffD]N\} }|dks”|dkr´q”|dkrÌ|  | ¡q”|  | ›d|›¡q”d  | ¡}t|ƒ}|
r@||
kr@t|ƒ}tjd!|›d"|›d#||›d$|›d%|
›d& dd|S)'a¯
Create a Set-Cookie header without the ``Set-Cookie`` prefix.
 
    The return value is usually restricted to ascii as the vast majority
    of values are properly escaped, but that is no guarantee. It's
    tunneled through latin1 as required by :pep:`3333`.
 
    The return value is not ASCII safe if the key contains unicode
    characters.  This is technically against the specification but
    happens in the wild.  It's strongly recommended to not use
    non-ASCII values for the keys.
 
    :param max_age: should be a number of seconds, or `None` (default) if
                    the cookie should last only as long as the client's
                    browser session.  Additionally `timedelta` objects
                    are accepted, too.
    :param expires: should be a `datetime` object or unix timestamp.
    :param path: limits the cookie to a given path, per default it will
                 span the whole domain.
    :param domain: Use this if you want to set a cross-domain cookie. For
                   example, ``domain=".example.com"`` will set a cookie
                   that is readable by the domain ``www.example.com``,
                   ``foo.example.com`` etc. Otherwise, a cookie will only
                   be readable by the domain that set it.
    :param secure: The cookie will only be available via HTTPS
    :param httponly: disallow JavaScript to access the cookie.  This is an
                     extension to the cookie standard and probably not
                     supported by all browsers.
    :param charset: the encoding for string values.
    :param sync_expires: automatically set expires if max_age is defined
                         but expires not.
    :param max_size: Warn if the final header value exceeds this size. The
        default, 4093, should be safely `supported by most browsers
        <cookie_>`_. Set to 0 to disable this check.
    :param samesite: Limits the scope of the cookie such that it will
        only be attached to requests if those requests are same-site.
 
    .. _`cookie`: http://browsercookielimits.squawky.net/
 
    .. versionchanged:: 2.3.3
        The ``path`` parameter is ``/`` by default.
 
    .. versionchanged:: 2.3.1
        The value allows more characters without quoting.
 
    .. versionchanged:: 2.3
        ``localhost`` and other names without a dot are allowed for the domain. A
        leading dot is ignored.
 
    .. versionchanged:: 2.3
        The ``path`` parameter is ``None`` by default.
 
    .. versionchanged:: 2.3
        Passing bytes, and the ``charset`` parameter, are deprecated and will be removed
        in Werkzeug 3.0.
 
    .. versionchanged:: 1.0.0
        The string ``'None'`` is accepted for ``samesite``.
    NzJThe 'charset' parameter is deprecated and will be removed in Werkzeug 3.0.rErFryzeThe 'key' parameter must be a string. Bytes are deprecated and will not be supported in Werkzeug 3.0.zgThe 'value' parameter must be a string. Bytes are deprecated and will not be supported in Werkzeug 3.0.z%!$&'()*+,/:=@)Úsafer~ú:rÚ.Úidnarz)Útz>r¡ÚLaxÚStrictz,SameSite must be 'Strict', 'Lax', or 'None'.cSs t| ¡Sr•)Ú_cookie_slash_mapÚgroup)Úmr;r;r<Ú<lambda>¾ózdump_cookie.<locals>.<lambda>rKrHr_ÚDomainZExpireszMax-AgeÚSecureÚHttpOnlyÚPathÚSameSiteFTr`zThe 'z%' cookie is too large: the value was z bytes but the header required z! extra bytes. The final size was z bytes but the limit is z> bytes. Browsers may silently ignore cookies larger than this.)rOrPrQrMrNrRr rÚlstriprürrãrçr?rárÚnowrrÚrÜÚtitleržÚ_cookie_no_quote_reÚ    fullmatchÚ_cookie_slash_reÚsubrarcrZ)rer@rrrr    r
r rùr r rÚbufÚkrr²Z cookie_sizeZ
value_sizer;r;r<Ú dump_cookie=sˆHü
ü
ü 
 
 
 
 
 ÿþ ù     
 
 
&ûr)z
int | None)rŒrÄrÃrCcCsp|dk|dkkrdS|dkr,|dkp*|dkS|dkrLd|koF|kSS||krXdSd|koj|kSS)zcChecks if a given byte content range is valid for the given length.
 
    .. versionadded:: 0.7
    NFrr;)rŒrÄrÃr;r;r<rÂìsrÂ)r­)Úhttp)NT)N)N)N)N)N)NN)N)NN)N)N)T)N)F)N)N)N)NNNT)rî)NNN) r†NNrÁNFFNTrN)dÚ
__future__rÚ email.utilsrÖÚreÚtypingr˜rOrrrrrÚenumr    Úhashlibr
r r Ú urllib.parser rÚurllib.requestrrtÚ    _internalrrrÚ TYPE_CHECKINGZ_typeshed.wsgirÚ    frozensetrSÚcompilerËr÷røZHTTP_STATUS_CODESr4r=rWr[rfrnrsrwr…ÚASCIIÚVERBOSErˆrrŠr’ÚTypeVarr“Úoverloadr–rŸÚOptionalÚCallabler r¤r¥r¦r§r«r¯r³r¶rÀrÅrÊrµrÐrÓr´rárårèrírôröròrõrýÚAr#r%rÚupdateÚranger)rÂr†r­r›Zsansior*rìr;r;r;r<Ú<module>s´                 ÿ
öÿøÿ ÀD
ý;0þ? X
ò
ú    |ÿ3ÿýÿý&þ!þ"ÿ=þ6    ÿ û(þ   ü1þô20