Your IP : 3.133.113.24


Current Path : /opt/alt/python35/lib64/python3.5/wsgiref/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/wsgiref/__pycache__/headers.cpython-35.opt-2.pyc



���]n�@sDddlZejd�Zdddd�ZGdd�d�ZdS)�Nz[ \(\)<>@,;:\\"/\[\]\?=]�cCsx|dk	rpt|�dkrp|s3tj|�r_|jdd�jdd�}d||fSd||fSn|SdS)Nr�\z\\�"z\"z%s="%s"z%s=%s)�len�	tspecials�search�replace)Zparam�value�quote�r�,/opt/alt/python35/lib64/python3.5/headers.py�_formatparam
sr
c@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
ddd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�ZdS)$�HeadersNcCsC|dk	r|ng}t|�tk	r6td��||_dS)Nz+Headers must be a list of name/value tuples)�type�list�	TypeError�_headers)�selfZheadersrrr�__init__s
	zHeaders.__init__cCs5t|�tkr|Stdjt|����dS)Nz1Header names/values must be of type str (got {0}))r�str�AssertionError�format�repr)rr	rrr�_convert_string_type)s	zHeaders._convert_string_typecCs
t|j�S)N)rr)rrrr�__len__0szHeaders.__len__cCs3||=|jj|j|�|j|�f�dS)N)r�appendr)r�name�valrrr�__setitem__4s	zHeaders.__setitem__csB|j�j����fdd�|jD�|jdd�<dS)Ncs,g|]"}|dj��kr|�qS)r)�lower)�.0�kv)rrr�
<listcomp>@s	z'Headers.__delitem__.<locals>.<listcomp>)rrr)rrr)rr�__delitem__:szHeaders.__delitem__cCs
|j|�S)N)�get)rrrrr�__getitem__Bs	zHeaders.__getitem__cCs|j|�dk	S)N)r$)rrrrr�__contains__MszHeaders.__contains__cs/|j�j����fdd�|jD�S)Ncs0g|]&}|dj��kr|d�qS)rr)r)r r!)rrrr"[s	z#Headers.get_all.<locals>.<listcomp>)rrr)rrr)rr�get_allRszHeaders.get_allcCsI|j|j��}x-|jD]"\}}|j�|kr|SqW|S)N)rrr)rr�default�k�vrrrr$^s
zHeaders.getcCsdd�|jD�S)NcSsg|]\}}|�qSrr)r r)r*rrrr"os	z Headers.keys.<locals>.<listcomp>)r)rrrr�keysgszHeaders.keyscCsdd�|jD�S)NcSsg|]\}}|�qSrr)r r)r*rrrr"ys	z"Headers.values.<locals>.<listcomp>)r)rrrr�valuesqszHeaders.valuescCs|jdd�S)N)r)rrrr�items{sz
Headers.itemscCsd|jj|jfS)Nz%s(%r))�	__class__�__name__r)rrrr�__repr__�szHeaders.__repr__cCs'djdd�|jD�ddg�S)Nz
cSsg|]}d|�qS)z%s: %sr)r r!rrrr"�s	z#Headers.__str__.<locals>.<listcomp>�)�joinr)rrrr�__str__�szHeaders.__str__cCst|�jd�S)Nz
iso-8859-1)r�encode)rrrr�	__bytes__�szHeaders.__bytes__cCsO|j|�}|dkrG|jj|j|�|j|�f�|S|SdS)N)r$rrr)rrr	�resultrrr�
setdefault�szHeaders.setdefaultcKs�g}|dk	r.|j|�}|j|�x�|j�D]t\}}|j|�}|dkr~|j|jdd��q;|j|�}|jt|jdd�|��q;W|jj|j|�dj|�f�dS)N�_�-z; )rrr-rr
rr2)r�_name�_valueZ_params�partsr)r*rrr�
add_header�s
&zHeaders.add_header)r/�
__module__�__qualname__rrrrr#r%r&r'r$r+r,r-r0r3r5r7r=rrrrrs"
	



r)�re�compilerr
rrrrr�<module>
s

?>