Your IP : 18.116.49.143


Current Path : /opt/alt/python38/lib64/python3.8/wsgiref/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/wsgiref/__pycache__/headers.cpython-38.opt-2.pyc

U

i�fn�@s.ddlZe�d�Zddd�ZGdd�d�ZdS)	�Nz[ \(\)<>@,;:\\"/\[\]\?=]�cCsX|dk	rPt|�dkrP|s"t�|�rB|�dd��dd�}d||fSd||fSn|SdS)Nr�\z\\�"z\"z%s="%s"z%s=%s)�len�	tspecials�search�replace)Zparam�valueZquote�r
�4/opt/alt/python38/lib64/python3.8/wsgiref/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|Std�t|����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&||=|j�|�|�|�|�f�dSr)r�appendr)r�name�valr
r
r�__setitem__4s�zHeaders.__setitem__cs0|�������fdd�|jD�|jdd�<dS)Ncs g|]}|d���kr|�qS)r��lower��.0Zkv�rr
r�
<listcomp>@sz'Headers.__delitem__.<locals>.<listcomp>�rr!r�rrr
r$r�__delitem__:szHeaders.__delitem__cCs
|�|�Sr��getr'r
r
r�__getitem__Bs	zHeaders.__getitem__cCs|�|�dk	Srr)r'r
r
r�__contains__MszHeaders.__contains__cs"|�������fdd�|jD�S)Ncs$g|]}|d���kr|d�qS)rrr r"r$r
rr%[sz#Headers.get_all.<locals>.<listcomp>r&r'r
r$r�get_allRszHeaders.get_allcCs6|�|���}|jD]\}}|��|kr|Sq|Srr&)rr�default�k�vr
r
rr*^s

zHeaders.getcCsdd�|jD�S)NcSsg|]\}}|�qSr
r
�r#r/r0r
r
rr%osz Headers.keys.<locals>.<listcomp>�rrr
r
r�keysgszHeaders.keyscCsdd�|jD�S)NcSsg|]\}}|�qSr
r
r1r
r
rr%ysz"Headers.values.<locals>.<listcomp>r2rr
r
r�valuesqszHeaders.valuescCs|jdd�Srr2rr
r
r�items{sz
Headers.itemscCsd|jj|jfS)Nz%s(%r))�	__class__�__name__rrr
r
r�__repr__�szHeaders.__repr__cCsd�dd�|jD�ddg�S)Nz
cSsg|]}d|�qS)z%s: %sr
r"r
r
rr%�sz#Headers.__str__.<locals>.<listcomp>�)�joinrrr
r
r�__str__�szHeaders.__str__cCst|��d�S)Nz
iso-8859-1)r�encoderr
r
r�	__bytes__�szHeaders.__bytes__cCs:|�|�}|dkr2|j�|�|�|�|�f�|S|SdSr)r*rrr)rrr	�resultr
r
r�
setdefault�s
�zHeaders.setdefaultcKs�g}|dk	r |�|�}|�|�|��D]P\}}|�|�}|dkrV|�|�dd��q(|�|�}|�t|�dd�|��q(|j�|�|�d�|�f�dS)N�_�-z; )rrr5rrrr:)r�_nameZ_valueZ_params�partsr/r0r
r
r�
add_header�s



zHeaders.add_header)N)N)r7�
__module__�__qualname__rrrrr(r+r,r-r*r3r4r5r8r;r=r?rDr
r
r
rr
s"


	



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



?>