Your IP : 18.188.211.58


Current Path : /opt/alt/python36/lib64/python3.6/wsgiref/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/wsgiref/__pycache__/headers.cpython-36.opt-2.pyc

3

��2an�@s.ddlZejd�Zddd�ZGdd�d�ZdS)	�Nz[ \(\)<>@,;:\\"/\[\]\?=]�cCsX|dk	rPt|�dkrP|s"tj|�rB|jdd�jdd�}d||fSd||fSn|SdS)Nr�\z\\�"z\"z%s="%s"z%s=%s)�len�	tspecials�search�replace)Zparam�valueZquote�r
�,/opt/alt/python36/lib64/python3.6/headers.py�_formatparam
src@s�eZdZd$dd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
d%dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�ZdS)&�HeadersNcCs.|dk	r|ng}t|�tk	r$td��||_dS)Nz+Headers must be a list of name/value tuples)�type�list�	TypeError�_headers)�selfZheadersr
r
r�__init__s
zHeaders.__init__cCs&t|�tkr|Stdjt|����dS)Nz1Header names/values must be of type str (got {0}))r�str�AssertionError�format�repr)rr	r
r
r�_convert_string_type)szHeaders._convert_string_typecCs
t|j�S)N)rr)rr
r
r�__len__0szHeaders.__len__cCs&||=|jj|j|�|j|�f�dS)N)r�appendr)r�name�valr
r
r�__setitem__4szHeaders.__setitem__cs0|j�j����fdd�|jD�|jdd�<dS)Ncs g|]}|dj��kr|�qS)r)�lower)�.0�kv)rr
r�
<listcomp>@sz'Headers.__delitem__.<locals>.<listcomp>)rrr)rrr
)rr�__delitem__:szHeaders.__delitem__cCs
|j|�S)N)�get)rrr
r
r�__getitem__Bs	zHeaders.__getitem__cCs|j|�dk	S)N)r#)rrr
r
r�__contains__MszHeaders.__contains__cs"|j�j����fdd�|jD�S)Ncs$g|]}|dj��kr|d�qS)rr)r)rr )rr
rr![sz#Headers.get_all.<locals>.<listcomp>)rrr)rrr
)rr�get_allRszHeaders.get_allcCs6|j|j��}x"|jD]\}}|j�|kr|SqW|S)N)rrr)rr�default�k�vr
r
rr#^s
zHeaders.getcCsdd�|jD�S)NcSsg|]\}}|�qSr
r
)rr(r)r
r
rr!osz Headers.keys.<locals>.<listcomp>)r)rr
r
r�keysgszHeaders.keyscCsdd�|jD�S)NcSsg|]\}}|�qSr
r
)rr(r)r
r
rr!ysz"Headers.values.<locals>.<listcomp>)r)rr
r
r�valuesqszHeaders.valuescCs|jdd�S)N)r)rr
r
r�items{sz
Headers.itemscCsd|jj|jfS)Nz%s(%r))�	__class__�__name__r)rr
r
r�__repr__�szHeaders.__repr__cCsdjdd�|jD�ddg�S)Nz
cSsg|]}d|�qS)z%s: %sr
)rr r
r
rr!�sz#Headers.__str__.<locals>.<listcomp>�)�joinr)rr
r
r�__str__�szHeaders.__str__cCst|�jd�S)Nz
iso-8859-1)r�encode)rr
r
r�	__bytes__�szHeaders.__bytes__cCs:|j|�}|dkr2|jj|j|�|j|�f�|S|SdS)N)r#rrr)rrr	�resultr
r
r�
setdefault�s
zHeaders.setdefaultcKs�g}|dk	r |j|�}|j|�x\|j�D]P\}}|j|�}|dkrX|j|jdd��q*|j|�}|jt|jdd�|��q*W|jj|j|�dj|�f�dS)N�_�-z; )rrr,rrrr1)r�_nameZ_valueZ_params�partsr(r)r
r
r�
add_header�s



zHeaders.add_header)N)N)r.�
__module__�__qualname__rrrrr"r$r%r&r#r*r+r,r/r2r4r6r;r
r
r
rr
s"


	



r
)Nr)�re�compilerrr
r
r
r
r�<module>
s



?>