4V=jZddlmZddlZddlZddlZddlZddlm Z ddlmZddlm Z ddlm Z ddlm Z ddl mZdd lmZdd l mZdd l mZdd lmZdd lmZddlmZddlmZejrddlmZedZejdZegdZ egdZ!iddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7id8d9d:d;dd?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYidZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddd Z"GddeZ#GddeZ$d$d%dZ%ejdej&Z'd&dZ(d'dZ)d(dZ*d)dZ+d*dZ,d+dZ-ejdej.Z/ejdej.Z0ejdej.ej1zZ2ejdej.Z3d,dZ4ejdej.Z5ej6ddZ7ej8d-dZ9ej8d.dZ9 d/d0dZ9ej6ddZ:ej8 d/d1dZ;ej8 d2d3dZ; d4d5dZ;ej6ddZd:d̈́Z? d$d;dЄZ@ d/ddׄZBej8d?dلZCej8d@d܄ZCdAdބZCdBdZDdCdZEdDdZF d/dEdZGd/dFdZHd/dGdZI dHdIdZJ dJdKdZKdLdZLdMdZMdMdZN d/dNdZOejdej&ZPejdej&ZQdddZReRSdgeTdd eTd d D dOdPdZUdQd!ZVdd"lWmXZYdd#lZm[Z\dS(R) annotationsNdate)datetime)time) timedelta)timezone)Enum)sha1)mktime) struct_time)quote)unquote) _dt_as_utc) _plain_int)WSGIEnvironmentzM!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~z&([Ww]/)?(?:"(.*?)"|(.*?))(?:\s*,\s*|$)) allowzcontent-encodingzcontent-languagezcontent-lengthcontent-locationz content-md5z content-rangez content-typeexpiresz last-modified) connectionz keep-alivezproxy-authenticatezproxy-authorizationtetrailerztransfer-encodingupgradedContinueezSwitching Protocolsf Processinggz Early HintsOKCreatedAcceptedzNon Authoritative Informationz No Contentz Reset ContentzPartial Contentz Multi StatuszAlready ReportedzIM Usedi,zMultiple Choicesi-zMoved Permanentlyi.Foundi/z See Otheri0z Not Modifiedi1z Use Proxyi2z Switch Proxyi3zTemporary Redirecti4zPermanent Redirectiz Bad Requesti UnauthorizedizPayment Requiredi Forbiddeniz Not FoundizMethod Not AllowedizNot AcceptableizProxy Authentication RequiredizRequest TimeoutiConflictiGoneizLength RequiredizPrecondition FailedizRequest Entity Too LargeizRequest URI Too LongizUnsupported Media TypeizRequested Range Not SatisfiableizExpectation Failediz I'm a teapotizMisdirected RequestizUnprocessable EntityiLockedizFailed Dependencyiz Too EarlyizUpgrade RequiredizPrecondition RequiredizToo Many RequestsizRequest 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) iiiiiiiiiiiiiceZdZdZdZdZdS)COEPzCross Origin Embedder Policies unsafe-nonez require-corpN)__name__ __module__ __qualname____doc__ UNSAFE_NONE REQUIRE_CORP;C:\PYTHON\_runtimes\venv\Lib\site-packages\werkzeug/http.pyr5r5{s((K!LLLr>r5ceZdZdZdZdZdZdS)COOPzCross Origin Opener Policiesr6zsame-origin-allow-popupsz same-originN)r7r8r9r:r;SAME_ORIGIN_ALLOW_POPUPS SAME_ORIGINr=r>r?rArAs$&&K9KKKr>rATvaluet.Any allow_tokenboolreturnstrct|}|sdS|rt}||r|S|dddd}d|dS)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:: 3.0 Passing bytes is not supported. .. versionchanged:: 3.0 The ``extra_chars`` parameter is removed. .. versionchanged:: 2.3 The value is quoted if it is the empty string. .. versionadded:: 0.5 z""\\\"\")rI _token_chars issupersetreplace)rDrF value_str token_charss r?quote_header_valuerTs{*E I t"  ! !) , ,  !!$//77UCCI y   r>z\\(.)ct|dkr?|d|dcxkrdkr&nn#td|ddS|S)aHRemove double quotes and backslash escapes from a header value. This is the reverse of :func:`quote_header_value`. :param value: The header value to unquote. .. versionchanged:: 3.2 Removes escape preceding any character. .. versionchanged:: 3.0 The ``is_filename`` parameter is removed. rrMz\g<1>r)len _unslash_resubrDs r?unquote_header_valuer\s] 5zzQ58uRy7777C77777xqt555 Lr>header str | Noneoptionst.Mapping[str, t.Any]c4g}||||D]V\}}||ddkr||d|/||dt|Wd|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. NrW*=; )appenditemsrTjoin)r]r_segmentskeyrDs r?dump_options_headerrjs:H mmooBB U =  r7c>> OOs,,U,, - - - - OOs@@%7%>%>@@ A A A A 99X  r>iterable$dict[str, t.Any] | t.Iterable[t.Any]ctt|trg}|D]k\}}||||ddkr||d|D||dt |ln d|D}d|S)a'Produce 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:: 3.0 The ``allow_token`` parameter is removed. .. versionchanged:: 2.2.3 If a key ends with ``*``, its value will not be quoted. NrWrbrcc,g|]}t|Sr=)rT.0xs r? zdump_header..s!9991#A&&999r>z, ) isinstancedictrfrerTrg)rkrfrirDs r? dump_headerrus@(D!! :"..** C CJC} S!!!!RC --e--.... AA&8&?&?AABBBB  C:9999 99U  r>ds.ContentSecurityPolicycddd|DS)zDump 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. rdc3*K|]\}}|d|VdS) Nr=rprirDs r? z"dump_csp_header..,s4GG*#u%%e%%GGGGGGr>)rgrfr]s r?dump_csp_headerr}"s- 99GG GGG G GGr> list[str]cg}d}d}d}|D]P}|rd}||z } |r|dkrd}n|dkrd}||z }%|dkr||d}C|dkrd}||z }Q|rgS||dd|DDS) aParse a header value that consists of a list of comma separated items according to `RFC 9110 `__. Surrounding quotes are removed from items, but internal quotes are left for future parsing. Empty values are discarded. .. 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. .. versionchanged:: 3.2 Quotes and escapes are kept if only part of an item is quoted. Empty values are omitted. An empty list is returned if the value contains an unclosed quoted string. FrKTrM,c0g|]}|t|Sr=)r\rpitems r?rrz%parse_list_header..gs6   '+SW T""   r>c3>K|]}|VdSN)striprs r?r{z$parse_list_header..hs*/O/O /O/O/O/O/O/Or>)re)rDrfrescaperchars r?parse_list_headerr/s* E D F E  F DLD   t|| DLD  3;; LL   D  3;;E     LL  /O/O/O/O/O   r>dict[str, str | None]ci}t|D]}|d\}}}|}|s2|sd||<:|}d}|ddkrf|dd}t|}|r+|\}}|}|dvrt||}t|||<|S)aParse 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 `__. Only ASCII, UTF-8, and ISO-8859-1 charsets are accepted, otherwise the value remains quoted. :param value: The header value to parse. .. versionchanged:: 3.2 An empty dict is returned if the value contains an unclosed quoted string. .. versionchanged:: 3.0 Passing bytes is not supported. .. versionchanged:: 3.0 The ``cls`` argument is removed. .. versionchanged:: 2.3 Added support for ``key*=charset''value`` encoded items. .. versionchanged:: 0.9 The ``cls`` argument was added. rcNrWrb>asciiutf-8us-ascii iso-8859-1encoding) r partitionr_charset_value_rematchgroupslowerrr\)rDresultrri has_valuerrs r?parse_dict_headerrlsF%'F!%((!2!2 $s 3 3Yiikk   F3K  # r7c>>crc(C%++E22E ,"',,..%#>>++ GGG999*511s Mr>z([\w!#$%&'*+\-.^`|~]+)=)flagsz[\w!#$%&'*+\-.^`|~]+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+)$tuple[str, dict[str, str]]c|difS|d\}}}|}|}|r|s|ifSg} t|x} |d}||d}t|x}*|||fn|dddkrsd}t|}||kr\|||dzdvr|dz }nA||dkr0|||d|dzf||dzd}n |dz }||k\| dx}d krn!||dzd }di} d} d} |D];\}} |d d krl|dd }t| } | r+| \} } | } | s| } | d vr| } t| | } | d | d cxkrdkrInnF| dd dddddd} t |} | r:|d| }| |d| z| |<6| | |<=|| fS)aParse 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 `__. Invalid parts are skipped. This handles continuations and charsets as described in `RFC 2231 `__, 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 `__ replaces it with ``%22`` in multipart form data. `RFC 9110 `__ 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 ````, 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 Nr;TrrMrV>rNrLrWrb>rrrrrrrLrKrNz%22)rr_parameter_key_rergrouprend_parameter_token_value_rererXfindlstriprrrrQ_continuation_researchstartget)rD_restpartsmpkposlengthrr_rcontinued_encodingpvrs r?parse_options_headerrs\r }2v __S))NE1d KKMME ::<> !Cb ( ( C!GII%%''?(B!GH%)((B b6S==CRCB%++B//E ,$||~~ "#>>++ .- GGG &."R(333 a5BrF ! ! ! !c ! ! ! ! !AbD!!&$//77sCCKKESVWWB ''++  OekkmmO$B!++b"--2GBKKGBKK '>r>z -?\d+(\.\d+)? _TAnyAccept ds.Accept)boundcdSrr=r[s r?parse_accept_headerrfs9<r>clstype[_TAnyAccept]cdSrr=)rDrs r?rrjsSVSVr>type[_TAnyAccept] | Nonec|/tjtttj}|s |dSg}t |D]}t|\}}d|vr_|d }t |Zt|}|dks|dkrvnd}|rt||}|||f||S)akParse an ``Accept`` header according to `RFC 9110 `__. 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. Nqrr)tcasttyperdsAcceptrrpopr _q_value_re fullmatchfloatrjre)rDrrrr_q_strrs r?rrns " {fT+& 22 s4yy F!%((!!,T22 g '>>KK$$**,,E$$U++3e A1uuAA  6&tW55D tQi    3v;;r>_TAnyCCzds.cache_control._CacheControl on_update9t.Callable[[ds.cache_control._CacheControl], None] | Noneds.RequestCacheControlcdSrr=rDrs r?parse_cache_control_headerrs !Sr>. type[_TAnyCC]cdSrr=rDrrs r?rrs cr>type[_TAnyCC] | Nonec|tjdtj}|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. Nrr=)rrrRequestCacheControlrrs r?rrsR* {f_b&<== "s2y!!! 3 '' 3 33r>_TAnyCSP3t.Callable[[ds.ContentSecurityPolicy], None] | NonecdSrr=rs r?parse_csp_headerrs  #sr>type[_TAnyCSP]cdSrr=rs r?rrs sr>type[_TAnyCSP] | Nonec|tjdtj}| |d|Sg}|dD]}|}d|vrf|dd\}}|||f|||S)aParse 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. Nrr=rryr)rrrContentSecurityPolicysplitrre)rDrrrfpolicy directives r?rrs" {f%r'?@@ }s2y!!! E++c""== &==%||~~33C;; Iu LL)//++U[[]]; < < < 3ui  r>'t.Callable[[ds.HeaderSet], None] | None ds.HeaderSetct|stjd|Stjt||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 HeaderSetrrs r?parse_set_headerr s98 -|D),,, <)%00) < < ds.IfRangec|stjSt|}|tj|Stjt|dS)zParses 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)rIfRange parse_date unquote_etag)rDrs r?parse_if_range_headerr*s[ z|| e  D zt$$$$ :l5))!, - --r>make_inclusiveds.Range | NonecH|rd|vrdSg}d}|dd\}}|}|dD],}|}d|vrdS|dr1|dkrdS t |}n#t $rYdSwxYwd}d}nd|vr|dd\} } | } | } t | }n#t $rYdSwxYw||ks|dkrdS| r0 t | dz}n#t $rYdSwxYw||krdSnd}||nd}|||f.tj||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 rcNrrr-rW) rrr startswithr ValueErrorrerRange) rDrrangeslast_endunitsrngrbeginr begin_strend_strs r?parse_range_headerr<s Cu$$t FHS!$$JE3 KKMM   ! !E #$$$$zz|| d??44 ??3   6!||tt "4((   ttt CHH D[[!%C!3!3 Iw!))ImmooG "9--   ttt x8a<<tt  $W--1CC!   444 C<<44 !oss2H ucl#### 8E6 " ""s6B.. B=<B= D D*)D*?E E! E!*t.Callable[[ds.ContentRange], None] | Noneds.ContentRange | Nonec|dS |pddd\}}n#t$rYdSwxYwd|vrdS|dd\}}|dkrd}n" t|}n#t$rYdSwxYw|dkr,t dd|sdSt j|dd||Sd|vrdS|dd\}} t|} t|dz} n#t$rYdSwxYwt | | |rt j|| | ||SdS)aParses 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. Nrr/rb)rr)rrrris_byte_range_validr ContentRange) rDrrrangedefr length_strr start_strstop_strrstops r?parse_content_range_headerrws }t ;B--//55dA>>xx tt (tnnS!,,OCS  ++FF   44  czz"4v66 4udD&INNNN Ct))C++Ix9%%(##a' tt5$//PueT6YOOOO 4s3-4 AA.A>> B  B !!D DDFetagweakcFd|vrtdd|d}|rd|}|S)ziQuote an etag. :param etag: the etag to quote. :param weak: set to `True` to tag it "weak". rMz invalid etagW/)rrrs r? quote_etagr s@  d{{((( t;;;D D{{ Kr>tuple[str, bool]cdSrr=rs r?rrs14r>Nonetuple[None, None]cdSrr=rs r?rrs363r>$tuple[str, bool] | tuple[None, None]c|sdS|}d}|dr d}|dd}|dd|ddcxkrd kr nn |dd}||fS) zUnquote 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/TrVNrrWrM)rrr s r?rrs z ::<ds.ETagsc|stjSg}g}t|}d}||krt||}|n~|\}}}|dkrtjdS|r|}|r||n|||}||ktj||S)zParse an etag header. :param value: the tag header to parse :return: an :class:`~werkzeug.datastructures.ETags` object. rNrbT)star_tag)rETagsrX_etag_rerrrer) rDstrongrrrris_weakquotedraws r? parse_etagsrs xzz F D e**C C ))uc** = $||~~ #::8T*** *  C   KK     MM#   iikk )) 8FD ! !!r>databytescDt|S)zGenerate an etag for some data. .. versionchanged:: 2.0 Use SHA-1. MD5 may not be available in some environments. )r hexdigest)r s r? generate_etagr$s ::   ! !!r>datetime | Nonec|dS tj|}n#ttf$rYdSwxYw|j |tjS|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``. Ntzinfo) emailutilsparsedate_to_datetime TypeErrorrr(rQr utc)rDdts r?rrsv }t [ . .u 5 5 z "tt yzzz... Is &;; timestamp2datetime | date | int | float | struct_time | Nonect|trst|ts.tj|t t j}nt|}tj |dSt|trt|}tj |dS)aFormat 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)rsrrcombinerr r-rr)r*format_datetimer r formatdate)r/s r? http_dater6s )T""C)X.. . (DFF8<PPPII#9--I{**9T*BBB)[))&9%% ; ! !)D ! 9 99r>timedelta | Nonec|sdS t|}n#t$rYdSwxYw|dkrdS t|S#t$rYdSwxYw)zParses 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)intrr OverflowError)rDr9s r? parse_ager<;s te** tt{{t)))) tts $$A A Aagetimedelta | int | Nonec|dSt|tr"t|}nt|}|dkrt dt |S)zFormats 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)rsrr: total_secondsrrI)r=s r?dump_agerAQsi {t#y!!###%%&&#hh Qww1222 s88Or>environr bytes | None last_modifieddatetime | str | Noneignore_if_rangec tj|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``. HTTP_RANGE HTTP_IF_RANGEHTTP_IF_MODIFIED_SINCEHTTP_IF_NONE_MATCH HTTP_IF_MATCH) http_range http_if_rangehttp_if_modified_sincehttp_if_none_match http_if_matchrr rDrF) _sansio_httpis_resource_modifiedr)rBrr rDrFs r?rSrSesw2  ,;;|,,kk/22&{{+CDD";;';<<kk/22  #'    r>rrheaders"ds.Headers | list[tuple[str, str]]allowedt.Iterable[str]cFdDfd|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. c6h|]}|Sr=)rros r? z(remove_entity_headers..s ***Qqwwyy***r>chg|].\}}t|r|v*||f/Sr=)is_entity_headerr)rprirDrWs r?rrz)remove_entity_headers..sP C$$), w(>(> e (>(>(>r>Nr=)rUrWs `r?remove_entity_headersr^sL +*'***G!GAAAJJJr>c(d|D|dd<dS)zRemove 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. c:g|]\}}t|||fSr=)is_hop_by_hop_headerrzs r?rrz-remove_hop_by_hop_headers..s>#e6J36O6O e r>Nr=)rUs r?remove_hop_by_hop_headersrbs,'.GAAAJJJr>c8|tvS)zCheck 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_headersr|s r?r]r]s <<>>_ ,,r>c8|tvS)zCheck 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_headersr|s r?raras <<>>0 00r>WSGIEnvironment | str | None#type[ds.MultiDict[str, str]] | Noneds.MultiDict[str, str]ct|tr|d}n|}|r'|d}t j||S)aOParse 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:: 3.0 Passing bytes, and the ``charset`` and ``errors`` parameters, were removed. .. 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. HTTP_COOKIElatin1)cookier)rsrtrencodedecoderR parse_cookie)r]rrms r?rprpsi4&$M** 2x((//11  $F < < <z#[\w!#$%&'()*+\-./:<=>?@\[\]^`{|}~]*s[\x00-\x19\",;\\\x7f-\xff]s\"s\\)"\c#LK|]}|ddd|zfV dS)rbigs\%03oN)to_bytes)rpvs r?r{r{sM ZZ59q=)r> s,;rrrimax_ager#str | datetime | int | float | Nonepathdomainsecurehttponly sync_expiresmax_sizer:samesite partitionedc |t|d}|rT|ddddd}t |t r!t|}|%t |tst|}nE|C|rAttj tj |z}| '| } | d vrt#d | rd }t$|sGt(d |d}d|d}|dd|g} d|fd|fd|fd|fd|fd|fd| fd| ffD]@\} }||dur |d ur| | &| | d|Ad| }t1|}| r>|| kr8t1|}t3jd|d|d||z d|d| d d!"|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 `_. 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. :param partitioned: Opts the cookie into partitioned storage. This will also set secure to True .. _`cookie`: http://browsercookielimits.squawky.net/ .. versionchanged:: 3.1 The ``partitioned`` parameter was added. .. versionchanged:: 3.0 Passing bytes, and the ``charset`` parameter, were removed. .. 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:: 1.0.0 The string ``'None'`` is accepted for ``samesite``. Nz%!$&'()*+,/:=@)safe:r.idnar)tz>LaxrStrictz,SameSite must be 'Strict', 'Lax', or 'None'.Tc@t|Sr)_cookie_slash_mapr)rs r?zdump_cookie..`s' 2r>rMrlrcDomainExpireszMax-AgeSecureHttpOnlyPathSameSite PartitionedFrdzThe '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.rV) stacklevel)rrrrnrorsrr:r@rIr6rnowr r-r/titler_cookie_no_quote_rer_cookie_slash_rerZrergrXwarningswarn)rirDr{rr}r~rrrrrrbufkrvrv cookie_size value_sizes r? dump_cookiersX T 0111 U!!#&&q)0055<>## 4 4 4KLL L  ( ( / / $$ 2 2ELLNN  &// E jjll!!(++ 5 5e 5 5 6C 6 G G 6 X  X  $ 1 9U  99 JJqMMM  a::!:: 3B b''K K(**ZZ   9C 9 9j 9 9 +j 8 9 9 9 99A 9 9 9      Ir>r int | Nonerrc|du|dukrdS| |dup|dkS|d|cxko|kncS||krdSd|cxko|kncS)zcChecks if a given byte content range is valid for the given length. .. versionadded:: 0.7 NFrr=)rrrs r?rrs  44<((u ~,1, E    D     $u         r>)datastructures)http)T)rDrErFrGrHrI)rDrIrHrI)r]r^r_r`rHrI)rkrlrHrI)r]rvrHrI)rDrIrHr~)rDrIrHr)rDr^rHr)rDr^rHr)rDr^rrrHrr)rDr^rrrHr)rDr^rrrHr)N.)rDr^rrrrrHrr)rDr^rrrrrHr)rDr^rrrHrv)rDr^rrrrrHr)rDr^rrrrrHr)rDr^rrrHr)rDr^rHr)rDr^rrGrHr)rDr^rrrHr)F)rrIrrGrHrI)rrIrHr )rrrHr)rr^rHr)rDr^rHr)r r!rHrI)rDr^rHr%)r/r0rHrI)rDr^rHr7)r=r>rHr^)NNNT) rBrrr^r rCrDrErFrGrHrG)rT)rUrVrWrXrHr)rUrVrHr)r]rIrHrG)r]rgrrhrHri) rNNrNFFTrzNF)rirIrDrIr{r>rr|r}r^r~r^rrGrrGrrGrr:rr^rrGrHrI)rrrrrrrHrG)] __future__r email.utilsr)retypingrrrrrrr enumr hashlibr r r urllib.parserr _internalrr TYPE_CHECKING_typeshed.wsgir frozensetrOcompilerrdrfHTTP_STATUS_CODESr5rArTArYr\rjrur}rrASCIIrrVERBOSErrrrTypeVarroverloadrrrrrrrrrr rrr$rr6r<rArSr^rbr]rarprrrupdaterangerrrrrsansiorrRr=r>r?rsN """"""  !!!!!!!!!!!!?/......yS  2:? @ @)      i     AA AA A  A  AA (AAA AA AA A  !A"#AA$%A&'A()A*+A, -A. /A01A23A4 5A67A89A: ;A< =A> (?A@ AABCADEAAAF GAH IAJ #KAL MAN !OAP *QAR SATUAV WAX YAZ[A\ ]A^_A` aAb cAd eAf *gAAh  (     % "    (AAAAH"""""4"""     4   !!!!!Hbj24(( &++++\----` H H H H::::zHHHHXBJ9JJJ&BJ'>bhOOOBJ Hrz 2:k2844XXXXvbj)2844 ai [999 <<< <VVV V8<22222j !)I%E F F FLP!!!! ! LP LP $44444< 19Z'A B B BFJ#### # FJ FJ!%!!!!!!!!!!L:>=====B....&/38#8#8#8#8#z=A33333l     444 4666 62"""":""""<EI:::::@,,+/ #####P ?0    ----111104"="="="="=J!bj!GNN2: