U e5dn@s.ddlZedZdddZGdddZdS) Nz[ \(\)<>@,;:\\"/\[\]\?=]cCsX|dk rPt|dkrP|s"t|rB|dddd}d||fSd||fSn|SdS)Nr\z\\"z\"z%s="%s"z%s=%s)len tspecialssearchreplace)ZparamvalueZquoter '/usr/lib64/python3.8/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|Stdt|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|jSN)rrrr r r __len__0szHeaders.__len__cCs&||=|j||||fdSr)rappendr)rnamevalr r r __setitem__4szHeaders.__setitem__cs0|fdd|jD|jdd<dS)Ncs g|]}|dkr|qS)rlower.0Zkvrr r @sz'Headers.__delitem__..rr!rrrr r$r __delitem__:szHeaders.__delitem__cCs ||Srgetr'r r r __getitem__Bs zHeaders.__getitem__cCs||dk Srr)r'r r r __contains__MszHeaders.__contains__cs"|fdd|jDS)Ncs$g|]}|dkr|dqS)rrr r"r$r r r%[sz#Headers.get_all..r&r'r r$r get_allRszHeaders.get_allcCs6||}|jD]\}}||kr|Sq|Srr&)rrdefaultkvr r r r*^s   z Headers.getcCsdd|jDS)NcSsg|] \}}|qSr r r#r/r0r r r r%osz Headers.keys..rrr r r keysgsz Headers.keyscCsdd|jDS)NcSsg|] \}}|qSr r r1r r r r%ysz"Headers.values..r2rr r r valuesqszHeaders.valuescCs|jddSrr2rr r r items{sz Headers.itemscCsd|jj|jfS)Nz%s(%r)) __class____name__rrr r r __repr__szHeaders.__repr__cCsddd|jDddgS)Nz cSsg|] }d|qS)z%s: %sr r"r r r r%sz#Headers.__str__..)joinrrr r r __str__szHeaders.__str__cCst|dS)Nz iso-8859-1)rencoderr r r __bytes__szHeaders.__bytes__cCs:||}|dkr2|j||||f|S|SdSr)r*rrr)rrr resultr r r setdefaults zHeaders.setdefaultcKsg}|dk r ||}|||D]P\}}||}|dkrV||ddq(||}|t|dd|q(|j||d|fdS)N_-z; )rrr5rr rr:)r_nameZ_valueZ_paramspartsr/r0r r r add_headers    zHeaders.add_header)N)N)r7 __module__ __qualname__rrrrr(r+r,r-r*r3r4r5r8r;r=r?rDr r r r r s"       r )Nr)recompilerr r r r r r  s