
    +h                        d dl mZ ddlmZ ddlmZ d Z G d dee      Z G d d	ee      Z G d
 de      Z	ddl
mZ y)    )annotations   )ImmutableDictMixin)UpdateDictMixinc                B     t         fd fd fdd       S )zReturn 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                *    | j                        S N)_get_cache_value)xemptykeytypes    X/var/www/html/venv/lib/python3.12/site-packages/werkzeug/datastructures/cache_control.py<lambda>z(cache_control_property.<locals>.<lambda>   s    !$$S%6     c                *    | j                  |      S r	   )_set_cache_value)r   vr   r   s     r   r   z(cache_control_property.<locals>.<lambda>   s    Q''Q5 r   c                &    | j                        S r	   )_del_cache_value)r   r   s    r   r   z(cache_control_property.<locals>.<lambda>   s    !$$S) r   zaccessor for )property)r   r   r   s   ```r   cache_control_propertyr      s%     65)
w	 r   c                      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	Zd
 Zd Zd Zd Zd Zd Z ee      Zy)_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-agezno-transformc                X    t         j                  | |xs d       || _        |d u| _        y )N )dict__init__	on_updateprovided)selfvaluesr!   s      r   r    z_CacheControl.__init__?   s'    dFLb)"d*r   c                t    |t         u r|| v S || v r| |   }||S |	  ||      }|S |S y# t        $ r Y |S w xY w+Used internally by the accessor properties.N)bool
ValueError)r#   r   r   r   values        r   r
   z_CacheControl._get_cache_valueD   sh    4<$;$;IE}! KE L5L " Ls   * 	77c                    |t         u r|rd| |<   y| j                  |d       y|| j                  |d       y|du rd| |<   y| ||      | |<   y|| |<   y)r'   NT)r(   pop)r#   r   r*   r   s       r   r   z_CacheControl._set_cache_valueT   sb    4< S	d#}d#$ S	# $UDI %DIr   c                    || v r| |= yyr&   r   )r#   r   s     r   r   z_CacheControl._del_cache_valuef   s    $;S	 r   c                ,    t        j                  |       S )z6Convert the stored values into a cache control header.)httpdump_headerr#   s    r   	to_headerz_CacheControl.to_headerk   s    %%r   c                "    | j                         S r	   )r2   r1   s    r   __str__z_CacheControl.__str__o   s    ~~r   c                    dj                  d t        | j                               D              }dt        |       j                   d| dS )N c              3  0   K   | ]  \  }}| d |  yw)=Nr   ).0kr   s      r   	<genexpr>z)_CacheControl.__repr__.<locals>.<genexpr>s   s     H41aQCq,Hs   <>)joinsorteditemsr   __name__)r#   kv_strs     r   __repr__z_CacheControl.__repr__r   sA    H6$**,3GHH4:&&'q22r   )r   N)rA   
__module____qualname____doc__r   no_cacher(   no_storeintmax_ageno_transformr    r
   r   r   r2   r4   rC   staticmethodcache_propertyr   r   r   r   r      sr    !F &j#t<H%j$=H$YC8G).$EL+
 &$
& 3 ""89Nr   r   c                  L    e Zd ZdZ edde      Z edde      Z edde      Z	y)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)
rA   rD   rE   rF   r   rI   	max_stale	min_freshr(   only_if_cachedr   r   r   rO   rO   y   s4    " '{C=I&{C=I+,<dDINr   rO   c                      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y)
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)rA   rD   rE   rF   r   r(   rU   rV   must_revalidateproxy_revalidaterI   s_maxagerW   r   r   r   rT   rT      s`    * $HdD9F$YT:G,->dKO-.@$M%j$<H&{D$?Ir   rT      )r/   N)
__future__r   mixinsr   r   r   r   r   rO   rT    r/   r   r   r   <module>r_      sH    " & #`:OT `:FJ,m J.@= @> r   