File: //lib64/python3.6/__pycache__/quopri.cpython-36.pyc
3
\T @ s d Z ddddgZdZdZdZdZyd d
lmZmZ W n e k
rP dZdZY nX dd
Z
dd ZdddZdddZ
dddZdddZdd Zdd Zdd Zedkre dS ) zHConversions to/from quoted-printable transport encoding as per RFC 1521.encodedecodeencodestringdecodestring =L s 0123456789ABCDEF )a2b_qpb2a_qpNc C sH t | tst| dkr|S | dkr&|S | tkpFd| ko@dkn S )zDecide 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 _ ~)
isinstancebytesAssertionErrorESCAPE)c quotetabsheader r /usr/lib64/python3.6/quopri.pyneedsquoting s r c C sB t | trt| dkstt| } ttt| d t| d f S )zQuote a single character. )r r lenr ordr HEX)r r r r quote$ s r Fc
C s< t dk r,| j }t |||d}|j| dS |dfdd}d}x| j }|sNP g } d}
|dd dkrv|dd
}d}
xL|D ]D}t|f}t|||rt|}|r|dkr| jd q|| j| q|W |dk r|| tj | }x:t
|tkr||dtd d
d |td d }qW |}q@W |dk r8|||
d dS )av Read '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.N)r r
c S sj | r<| dd dkr<|j | d d t| dd | n*| dkrX|j t| | n|j | | d S )Nr s .r r )writer )soutputlineEndr r r r! ; s
(zencode.<locals>.writer r r r s =
)r$ r r )r
readr! readliner r r appendEMPTYSTRINGjoinr MAXLINESIZE)
inputr# r r dataodatar! ZprevlinelineZoutlinestrippedr Zthisliner r r r , s@
c C sF t d k rt | ||dS ddlm} || }| }t|||| |j S )N)r r r )BytesIO)r
ior0 r getvalue)r"