a
    -=ic*                     @   s"  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 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 e dZdeje eje eje eje eje eje eje ejejeef  eed
ddZdejeedf eeejejd  ddddZddlmZ dS )    N)datetime   )_cookie_parse_impl)
_dt_as_utc)_to_str)generate_etag)
parse_date)parse_etags)parse_if_range_header)unquote_etagz&([Ww]/)?(?:"(.*?)"|(.*?))(?:\s*,\s*|$)T)

http_rangehttp_if_rangehttp_if_modified_sincehttp_if_none_matchhttp_if_matchetagdatalast_modifiedignore_if_rangereturnc	                 C   s  |du r|durt |}n|dur*tdd}	t|tr@t|}|durXt|jdd}d}
|sp| durpt|}
|
dur|
jdur|
j}nt|}|r|r||krd}	|rt	|\}}t
t|}|
dur|
jdurt|
j|}	n0t|}|r||}	t|}|r|| }	|	 S )a  Convenience method for conditional requests.
    :param http_range: Range HTTP header
    :param http_if_range: If-Range HTTP header
    :param http_if_modified_since: If-Modified-Since HTTP header
    :param http_if_none_match: If-None-Match HTTP header
    :param http_if_match: If-Match HTTP header
    :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`.

    .. versionadded:: 2.2
    Nzboth data and etag givenFr   )microsecondT)r   	TypeError
isinstancestrr   r   replacer
   dater   tcastr   r	   containsZcontains_weakZ	is_strong)r   r   r   r   r   r   r   r   r   Z
unmodifiedZif_rangeZmodified_since_Zif_none_matchZif_match r    e/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/werkzeug/sansio/http.pyis_resource_modified   s:    


r"    utf-8r   zds.MultiDictzds.MultiDict[str, str])cookiecharseterrorsclsr   c                    sT   t trdd|du r$tj}tjtjttf  d fdd}|| S )a/  Parse a cookie from a string.

    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 cookie: The cookie header as a string.
    :param charset: The charset for the cookie values.
    :param errors: The error behavior for the charset decoding.
    :param cls: A dict-like class to store the parsed cookies in.
        Defaults to :class:`MultiDict`.

    .. versionadded:: 2.2
    latin1r   N)r   c                  3   sF   t D ]8\} }t|  dd}|s&qt| dd}||fV  qd S )NT)Zallow_none_charset)r   r   )keyvalkey_strZval_strr&   r%   r'   r    r!   _parse_pairs~   s    z"parse_cookie.<locals>._parse_pairs)r   r   encodedsZ	MultiDictr   IteratorTuple)r%   r&   r'   r(   r.   r    r-   r!   parse_cookiea   s    
&
r3   )datastructures)	NNNNNNNNT)r#   r$   r   N)retypingr   r   	_internalr   r   r   httpr   r   r	   r
   r   compileZ_etag_reOptionalr   bytesUnionboolr"   Typer3   r#   r4   r0   r    r    r    r!   <module>   sX   
         Q    +