Your IP : 216.73.216.213


Current Path : /opt/alt/python37/lib/python3.7/site-packages/webob/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/webob/__pycache__/cachecontrol.cpython-37.pyc

B

�#�N��@sldZddlZGdd�de�Ze�d�Ze�d�ZGdd�de�ZGd	d
�d
e�Z	Gdd�de�Z
d
d�ZdS)z%
Represents the Cache-Control header
�Nc@sZeZdZdZdZdZdd�Zdd�Zdd�Zd	d
�Z	dd�Z
dd
d�Zdd�Zdd�Z
dS)�
UpdateDictz1
    Dict that has a callback on all updates
    NcCs.|j}|dk	r*|j}|dkr"|f}||�dS)z=
        Assign to new_dict.updated to track updates
        N)�updated�updated_args)�selfr�args�r�C/opt/alt/python37/lib/python3.7/site-packages/webob/cachecontrol.py�_updatedszUpdateDict._updatedcCst�|||�|��dS)N)�dict�__setitem__r	)r�key�itemrrrrszUpdateDict.__setitem__cCst�||�|��dS)N)r
�__delitem__r	)rrrrrrszUpdateDict.__delitem__cCst�|�|��dS)N)r
�clearr	)rrrrr#s
zUpdateDict.clearcOstj|f|�|�|��dS)N)r
�updater	)rr�kwrrrr'szUpdateDict.updatecCs"t�|||�}||kr|��|S)N)r
�
setdefaultr	)rr�value�valrrrr+szUpdateDict.setdefaultcGstj|f|��}|��|S)N)r
�popr	)rr�vrrrr1szUpdateDict.popcCst�|�}|��|S)N)r
�popitemr	)rrrrrr6s
zUpdateDict.popitem)N)�__name__�
__module__�__qualname__�__doc__rrr	rrrrrrrrrrrrs
rz8([a-zA-Z][a-zA-Z_-]*)\s*(?:=(?:"([^"]*)"|([^ \t",;]*)))?z[^a-zA-Z0-9._-]c@s4eZdZdZddd�Zddd�Zdd�Zd	d
�ZdS)
�exists_propertyzv
    Represents a property that either is listed in the Cache-Control
    header, or is not listed (has no value)
    NcCs||_||_dS)N)�prop�type)rrrrrr�__init__Fszexists_property.__init__cCs|dkr|S|j|jkS)N)r�
properties)r�objrrrr�__get__Jszexists_property.__get__cCsV|jdk	r*|j|jkr*td|j|jf��|r<d|j|j<n|j|jkrR|j|j=dS)Nz0The property %s only applies to %s Cache-Control)r�AttributeErrorrr )rr!rrrr�__set__Os
zexists_property.__set__cCs|�|d�dS)NF)r$)rr!rrr�
__delete__\szexists_property.__delete__)N)N)rrrrrr"r$r%rrrrrAs



rc@s4eZdZdZddd�Zddd�Zdd�Zd	d
�ZdS)
�value_propertyz�
    Represents a property that has a value in the Cache-Control header.

    When no value is actually given, the value of self.none is returned.
    NcCs||_||_||_||_dS)N)r�default�noner)rrr'r(rrrrrfszvalue_property.__init__cCsB|dkr|S|j|jkr8|j|j}|dkr2|jS|Sn|jSdS)N)rr r(r')rr!rrrrrr"lszvalue_property.__get__cCsr|jdk	r*|j|jkr*td|j|jf��||jkrL|j|jkrn|j|j=n"|dkrbd|j|j<n||j|j<dS)Nz0The property %s only applies to %s Cache-ControlT)rr#rr'r )rr!rrrrr$xs

zvalue_property.__set__cCs|j|jkr|j|j=dS)N)rr )rr!rrrr%�szvalue_property.__delete__)NNN)N)rrrrrr"r$r%rrrrr&`s


r&c@s�eZdZdZeZdd�Zed dd��Zdd�Z	e
d	d
dd�Ze
d
dd�Ze
ddd�Ze
ddd�Ze
dd
dd�Ze
dd
d�Ze
d�Ze
d�Ze
ddd�Ze
ddd�Ze
ddd�Ze
ddd�ZeZdd�Zdd�ZdS)!�CacheControlz�
    Represents the Cache-Control header.

    By giving a type of ``'request'`` or ``'response'`` you can
    control what attributes are allowed (some Cache-Control values
    only apply to requests or responses).
    cCs||_||_dS)N)r r)rr rrrrr�szCacheControl.__init__Nc		Cs�|r|��}||_ni}xbt�|�D]T}|�d�}|�d�pH|�d�pHd}|rpyt|�}Wntk
rnYnX|||<q$W|||d�}|r�|f|_|S)z�
        Parse the header, returning a CacheControl object.

        The object is bound to the request or response object
        ``updates_to``, if that is given.
        ���N)r)�update_dictr�token_re�finditer�group�int�
ValueErrorr)	�cls�headerZ
updates_tor�props�match�namerr!rrr�parse�s"
zCacheControl.parsecCsdt|�S)Nz<CacheControl %r>)�str)rrrr�__repr__�szCacheControl.__repr__z	max-stale�*�request)r(rz	min-fresh)rzonly-if-cached�public�response�privatezno-cache)r(zno-storezno-transformzmust-revalidatezproxy-revalidatezmax-age���zs-maxagecCs
t|j�S)N)�serialize_cache_controlr )rrrr�__str__�szCacheControl.__str__cCs|j|j��|jd�S)z0
        Returns a copy of this object.
        )r)�	__class__r �copyr)rrrrrD�szCacheControl.copy)NN)rrrrrr-r�classmethodr8r:r&Z	max_staleZ	min_freshrZonly_if_cachedr=r?Zno_cacheZno_storeZno_transformZmust_revalidateZproxy_revalidateZmax_ageZs_maxageZ	s_max_agerBrDrrrrr)�s*r)cCsxt|t�r|j}g}xXt|���D]H\}}|dkr>|�|�q"t|�}t�|�rXd|}|�d||f�q"Wd�	|�S)Nz"%s"z%s=%sz, )
�
isinstancer)r �sorted�items�appendr9�
need_quote_re�search�join)r �partsr7rrrrrA�s


rA)r�rer
r�compiler.rJ�objectrr&r)rArrrr�<module>s6
+M