o
    ê}”e›  ã                   @  sp   d dl mZ ddlmZ ddlmZ dd„ ZG dd„ deeƒZG d	d
„ d
eeƒZG dd„ deƒZ	ddl
mZ dS )é    )Úannotationsé   )ÚImmutableDictMixin)ÚUpdateDictMixinc                   s2   t ‡ ‡‡fdd„‡‡fdd„‡fdd„dˆ›�ƒS )zÆReturn a new property object for a cache header. Useful if you
    want to add support for a cache extension in a subclass.

    .. versionchanged:: 2.0
        Renamed from ``cache_property``.
    c                   s   |   ˆˆ ˆ¡S ©N)Ú_get_cache_value©Úx©ÚemptyÚkeyÚtype© ún/Users/abhinavbhinder/Documents/map/venv/lib/python3.10/site-packages/werkzeug/datastructures/cache_control.pyÚ<lambda>   ó    z(cache_control_property.<locals>.<lambda>c                   s   |   ˆ |ˆ¡S r   )Ú_set_cache_value)r	   Úv)r   r   r   r   r      r   c                   s
   |   ˆ ¡S r   )Ú_del_cache_valuer   )r   r   r   r      s   
 zaccessor for )Úproperty)r   r   r   r   r
   r   Úcache_control_property   s   
ür   c                   @  s‚   e Zd ZdZedddƒZeddeƒZeddeƒZ	edddƒZ
dd
d„Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZeeƒZdS )Ú_CacheControlaÒ  Subclass of a dict that stores values for a Cache-Control header.  It
    has accessors for all the cache-control directives specified in RFC 2616.
    The class does not differentiate between request and response directives.

    Because the cache-control directives in the HTTP header use dashes the
    python descriptors use underscores for that.

    To get a header of the :class:`CacheControl` object again you can convert
    the object into a string or call the :meth:`to_header` method.  If you plan
    to subclass it and add your own items have a look at the sourcecode for
    that class.

    .. versionchanged:: 2.1.0
        Setting int properties such as ``max_age`` will convert the
        value to an int.

    .. versionchanged:: 0.4

       Setting `no_cache` or `private` to boolean `True` will set the implicit
       none-value which is ``*``:

       >>> cc = ResponseCacheControl()
       >>> cc.no_cache = True
       >>> cc
       <ResponseCacheControl 'no-cache'>
       >>> cc.no_cache
       '*'
       >>> cc.no_cache = None
       >>> cc
       <ResponseCacheControl ''>

       In versions before 0.5 the behavior documented here affected the now
       no longer existing `CacheControl` class.
    zno-cacheÚ*Nzno-storezmax-ageéÿÿÿÿzno-transformr   c                 C  s$   t  | |pd¡ || _|d u| _d S )Nr   )ÚdictÚ__init__Ú	on_updateÚprovided)ÚselfÚvaluesr   r   r   r   r   ?   s   z_CacheControl.__init__c                 C  s`   |t u r|| v S || v r.| | }|du r|S |dur,z||ƒ}W |S  ty+   Y |S w |S dS ©ú+Used internally by the accessor properties.N)ÚboolÚ
ValueError)r   r   r   r   Úvaluer   r   r   r   D   s    
þþz_CacheControl._get_cache_valuec                 C  sx   |t u r|rd| |< dS |  |d¡ dS |du r |  |d¡ dS |du r*d| |< dS |dur6||ƒ| |< dS || |< dS )r!   NT)r"   Úpop)r   r   r$   r   r   r   r   r   T   s   z_CacheControl._set_cache_valuec                 C  s   || v r	| |= dS dS r    r   )r   r   r   r   r   r   f   s   
ÿz_CacheControl._del_cache_valuec                 C  s
   t  | ¡S )z6Convert the stored values into a cache control header.)ÚhttpZdump_header©r   r   r   r   Ú	to_headerk   s   
z_CacheControl.to_headerc                 C  s   |   ¡ S r   )r(   r'   r   r   r   Ú__str__o   s   z_CacheControl.__str__c                 C  s4   d  dd„ t|  ¡ ƒD ƒ¡}dt| ƒj› d|› d�S )Nú c                 s  s"   � | ]\}}|› d |›�V  qdS )ú=Nr   )Ú.0Úkr   r   r   r   Ú	<genexpr>s   s   €  z)_CacheControl.__repr__.<locals>.<genexpr>ú<ú>)ÚjoinÚsortedÚitemsr   Ú__name__)r   Zkv_strr   r   r   Ú__repr__r   s   z_CacheControl.__repr__)r   N)r4   Ú
__module__Ú__qualname__Ú__doc__r   Úno_cacher"   Úno_storeÚintZmax_ageZno_transformr   r   r   r   r(   r)   r5   ÚstaticmethodZcache_propertyr   r   r   r   r      s    #
r   c                   @  s4   e Zd ZdZeddeƒZeddeƒZeddeƒZ	dS )ÚRequestCacheControla…  A cache control for requests.  This is immutable and gives access
    to all the request-relevant cache control headers.

    To get a header of the :class:`RequestCacheControl` object again you can
    convert the object into a string or call the :meth:`to_header` method.  If
    you plan to subclass it and add your own items have a look at the sourcecode
    for that class.

    .. versionchanged:: 2.1.0
        Setting int properties such as ``max_age`` will convert the
        value to an int.

    .. versionadded:: 0.5
       In previous versions a `CacheControl` class existed that was used
       both for request and response.
    z	max-staler   z	min-freshzonly-if-cachedN)
r4   r6   r7   r8   r   r;   Z	max_staleÚ	min_freshr"   Zonly_if_cachedr   r   r   r   r=   y   s
    r=   c                   @  sX   e Zd ZdZeddeƒZedddƒZeddeƒZeddeƒZ	edde
ƒZed	deƒZdS )
ÚResponseCacheControlaø  A cache control for responses.  Unlike :class:`RequestCacheControl`
    this is mutable and gives access to response-relevant cache control
    headers.

    To get a header of the :class:`ResponseCacheControl` object again you can
    convert the object into a string or call the :meth:`to_header` method.  If
    you plan to subclass it and add your own items have a look at the sourcecode
    for that class.

    .. versionchanged:: 2.1.1
        ``s_maxage`` converts the value to an int.

    .. versionchanged:: 2.1.0
        Setting int properties such as ``max_age`` will convert the
        value to an int.

    .. versionadded:: 0.5
       In previous versions a `CacheControl` class existed that was used
       both for request and response.
    ÚpublicNÚprivater   zmust-revalidatezproxy-revalidatezs-maxageÚ	immutable)r4   r6   r7   r8   r   r"   r@   rA   Zmust_revalidateZproxy_revalidater;   Zs_maxagerB   r   r   r   r   r?   �   s    r?   é   )r&   N)Ú
__future__r   Úmixinsr   r   r   r   r   r=   r?   Ú r&   r   r   r   r   Ú<module>   s    c