o
    q>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 )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                   s   |   S N)_get_cache_valuexemptykeytype f/var/www/bmteknikk.ddns.net/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-agez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.)http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   kv_strr   r   r   __repr__r   s   z_CacheControl.__repr__)r   N)r5   
__module____qualname____doc__r   no_cacher"   no_storeintmax_ageno_transformr   r   r   r   r)   r*   r7   staticmethod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)
r5   r8   r9   r:   r   r=   	max_stale	min_freshr"   only_if_cachedr   r   r   r   rB   y   s
    rB   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)r5   r8   r9   r:   r   r"   rG   rH   must_revalidateproxy_revalidater=   s_maxagerI   r   r   r   r   rF      s    rF      )r&   N)
__future__r   mixinsr   r   r   r   r   rB   rF    r&   r   r   r   r   <module>   s    c