3 \n@s.ddlZejdZdddZGdddZdS) Nz[ \(\)<>@,;:\\"/\[\]\?=]cCsX|dk rPt|dkrP|s"tj|rB|jddjdd}d||fSd||fSn|SdS)Nr\z\\"z\"z%s="%s"z%s=%s)len tspecialssearchreplace)ZparamvalueZquoter '/usr/lib64/python3.6/wsgiref/headers.py _formatparam s  r c@seZdZd$ddZddZddZdd Zd d Zd d ZddZ ddZ d%ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#ZdS)&HeadersNcCs.|dk r |ng}t|tk r$td||_dS)Nz+Headers must be a list of name/value tuples)typelist TypeError_headers)selfZheadersr r r __init__s  zHeaders.__init__cCs&t|tkr|Stdjt|dS)Nz1Header names/values must be of type str (got {0}))rstrAssertionErrorformatrepr)rr r r r _convert_string_type)s zHeaders._convert_string_typecCs t|jS)N)rr)rr r r __len__0szHeaders.__len__cCs&||=|jj|j||j|fdS)N)rappendr)rnamevalr r r __setitem__4szHeaders.__setitem__cs0|jjfdd|jD|jdd<dS)Ncs g|]}|djkr|qS)r)lower).0kv)rr r @sz'Headers.__delitem__..)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"|jjfdd|jDS)Ncs$g|]}|djkr|dqS)rr)r)rr )rr r r![sz#Headers.get_all..)rrr)rrr )rr get_allRszHeaders.get_allcCs6|j|j}x"|jD]\}}|j|kr|SqW|S)N)rrr)rrdefaultkvr r r r#^s  z Headers.getcCsdd|jDS)NcSsg|] \}}|qSr r )rr(r)r r r r!osz Headers.keys..)r)rr r r keysgsz Headers.keyscCsdd|jDS)NcSsg|] \}}|qSr r )rr(r)r r r r!ysz"Headers.values..)r)rr r r valuesqszHeaders.valuescCs|jddS)N)r)rr r r items{sz Headers.itemscCsd|jj|jfS)Nz%s(%r)) __class____name__r)rr r r __repr__szHeaders.__repr__cCsdjdd|jDddgS)Nz cSsg|] }d|qS)z%s: %sr )rr r r r r!sz#Headers.__str__..)joinr)rr r r __str__szHeaders.__str__cCst|jdS)Nz iso-8859-1)rencode)rr r r __bytes__szHeaders.__bytes__cCs:|j|}|dkr2|jj|j||j|f|S|SdS)N)r#rrr)rrr resultr r r setdefaults  zHeaders.setdefaultcKsg}|dk r |j|}|j|x\|jD]P\}}|j|}|dkrX|j|jddq*|j|}|jt|jdd|q*W|jj|j|dj|fdS)N_-z; )rrr,rr rr1)r_nameZ_valueZ_paramspartsr(r)r r r add_headers    zHeaders.add_header)N)N)r. __module__ __qualname__rrrrr"r$r%r&r#r*r+r,r/r2r4r6r;r r r r r s"       r )Nr)recompilerr r r r r r  s