Viewing File: /opt/alt/python35/lib64/python3.5/__pycache__/quopri.cpython-35.opt-1.pyc



¯ÕYfaã@sýdZddddgZdZdZdZdZyd	d
lmZmZWne	k
rjdZdZYnXdd
„Z
dd„Zddd„Zdddd„Z
ddd„Zddd„Zdd„Zdd„Zdd„ZedkrùeƒdS)zHConversions to/from quoted-printable transport encoding as per RFC 1521.ÚencodeÚdecodeÚencodestringÚdecodestringó=éLs0123456789ABCDEFóé)Úa2b_qpÚb2a_qpNcCsG|dkr|S|dkr |S|tkpFd|koCdknS)zìDecide whether a particular byte ordinal needs to be quoted.

    The 'quotetabs' flag indicates whether embedded tabs and spaces should be
    quoted.  Note that line-ending tabs and spaces are always encoded, as per
    RFC 1521.
    s 	ó_ó ó~)ÚESCAPE)ÚcÚ	quotetabsÚheader©rú+/opt/alt/python35/lib64/python3.5/quopri.pyÚneedsquotings
rcCs0t|ƒ}ttt|dt|dfƒS)zQuote a single character.é)ÚordrÚbytesÚHEX)rrrrÚquote$srFc
Cs®tdk	rA|jƒ}t|d|d|ƒ}|j|ƒdS|ddd„}d}x2|jƒ}|soPg}	d}
|d
d…dkr§|dd…}d}
xj|D]b}t|fƒ}t|||ƒrát|ƒ}|r|d	kr|	jd
ƒq®|	j|ƒq®W|dk	r*||ƒtj	|	ƒ}xHt
|ƒtkrƒ||dtd…ddƒ|tdd…}q<W|}q\W|dk	rª||d|
ƒdS)avRead 'input', apply quoted-printable encoding, and write to 'output'.

    'input' and 'output' are binary file objects. The 'quotetabs' flag
    indicates whether embedded tabs and spaces should be quoted. Note that
    line-ending tabs and spaces are always encoded, as per RFC 1521.
    The 'header' flag indicates whether we are encoding spaces as _ as per RFC
    1522.Nrrs
cSs‰|rN|dd…dkrN|j|dd…t|dd…ƒ|ƒn7|dkrt|jt|ƒ|ƒn|j||ƒdS)Nés 	ó.éÿÿÿÿrr)Úwriter)ÚsÚoutputÚlineEndrrrr;s
2zencode.<locals>.writerrrrr s=
rr)r
ÚreadrÚreadlinerrrÚappendÚEMPTYSTRINGÚjoinÚlenÚMAXLINESIZE)
ÚinputrrrÚdataÚodatarZprevlineÚlineZoutlineZstrippedrZthislinerrrr,s@	




cCsdtdk	r"t|d|d|ƒSddlm}||ƒ}|ƒ}t||||ƒ|jƒS)Nrrr)ÚBytesIO)r
Úior,rÚgetvalue)rrrr,ÚinfpÚoutfprrrrjs	cCs‰tdk	r;|jƒ}t|d|ƒ}|j|ƒdSd}x.|jƒ}|sWPdt|ƒ}}|dkrÚ||d|…dkrÚd}	|d}x=|dkrÖ||d|…dkrÖ|d}q£Wnd}	xn||krP|||d…}
|
dkr,|r,|d	}|d}qã|
tkrO||
}|d}qã|d|krp|	rpd}	Pqã|d|krµ||d|d
…tkrµ|t}|d
}qã|d
|kr9t||d|d
…ƒr9t||d
|d…ƒr9|tt||d|d…ƒfƒ}|d}qã||
}|d}qãW|	sD|j|dƒd}qDW|r…|j|ƒdS)z»Read 'input', apply quoted-printable decoding, and write to 'output'.
    'input' and 'output' are binary file objects.
    If 'header' is true, decode underscore as space (per RFC 1522).Nrrrrs
s 	
rréé)	r	r!rr"r&rÚishexrÚunhex)r(rrr)r*Únewr+ÚiÚnÚpartialrrrrrusR
&
)



.

L+


cCs^tdk	rt|d|ƒSddlm}||ƒ}|ƒ}t||d|ƒ|jƒS)Nrr)r,)r	r-r,rr.)rrr,r/r0rrrr s	cCsPd|kodknpOd|ko3dknpOd|koMdkSS)zDReturn true if the byte ordinal 'c' is a hexadecimal digit in ASCII.ó0ó9óaófóAóFr)rrrrr3¬sr3cCsËd}x¾|D]¶}t|fƒ}d|ko9dknrMtdƒ}n^d|koddknr|tdƒd}n/d	|ko“d
knr«td	ƒd}n|dt|ƒ|}q
W|S)z.Get the integer value of a hexadecimal number.rr9r:Ú0r;r<Úaé
r=r>r)rr)rÚbitsrr6rrrr4±s
r4c(Cs)ddl}ddl}y)|j|jdd…dƒ\}}Wni|jk
r¬}zF|j|_t|ƒtdƒtdƒtdƒ|jdƒWYdd}~XnXd}d}x8|D]0\}}|dkrÞd}|d	krÀd}qÀW|r#|r#|j|_td
ƒ|jdƒ|s2dg}d}	x×|D]Ï}
|
dkr`|jj	}n^yt
|
dƒ}WnHtk
r½}z(|jjd
|
|fƒd}	w?WYdd}~XnXz6|rÝt
||jj	ƒnt||jj	|ƒWd|
dkr
|jƒXq?W|	r%|j|	ƒdS)NrrZtdz"usage: quopri [-t | -d] [file] ...z-t: quote tabsz-d: decode; default encoder1z-tz-dz -t and -d are mutually exclusiveú-Úrbz%s: can't open (%s)
)ÚsysÚgetoptÚargvÚerrorÚstderrÚstdoutÚprintÚexitÚstdinÚbufferÚopenÚOSErrorrrrÚclose)rErFZoptsÚargsÚmsgZdecoZtabsÚor@ÚstsÚfileÚfprrrÚmainÃsT)



 


	
rXÚ__main__)Ú__doc__Ú__all__rr'rr$Zbinasciir	r
ÚImportErrorrrrrrrr3r4rXÚ__name__rrrrÚ<module>s*
>+.
Back to Directory File Manager