AlkantarClanX12

Your IP : 3.16.70.218


Current Path : /proc/self/root/opt/alt/python33/lib64/python3.3/email/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python33/lib64/python3.3/email/__pycache__/_encoded_words.cpython-33.pyo

�
��f�c@svdZddlZddlZddlZddlZddlmZmZddlm	Z	ddddd	d
ddgZ
ejejd
�j
dd��Zdd�ZGdd�de�Ze�Zdeed�<dd�Zdd	�Zdd�Zdd�Zdd
�Zied6ed6Zdd�Zied6ed6Zied6ed6Zddddd�ZdS( u� Routines for manipulating RFC2047 encoded words.

This is currently a package-private API, but will be considered for promotion
to a public API if there is demand.

iN(u
ascii_lettersudigits(uerrorsudecode_quencode_qudecode_buencode_bulen_qulen_budecodeuencodes=([a-fA-F0-9]{2})cCstt|jd�d�g�S(Nii(ubytesuintugroup(um((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyu<lambda>Asu<lambda>cCs"|jdd�}t|�gfS(Ns_s (ureplaceu_q_byte_subber(uencoded((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyudecode_qCscBs@|EeZdZdejd�ejd�Zdd�ZdS(u	_QByteMaps-!*+/uasciicCs=||jkr"t|�||<ndj|�||<||S(Nu={:02X}(usafeuchruformat(uselfukey((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyu__missing__Msu_QByteMap.__missing__N(u__name__u
__module__u__qualname__u
ascii_lettersuencodeudigitsusafeu__missing__(u
__locals__((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyu	_QByteMapIs u	_QByteMapu_u cCsdjdd�|D��S(Nucss|]}t|VqdS(N(u_q_byte_map(u.0ux((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyu	<genexpr>Zsuencode_q.<locals>.<genexpr>(ujoin(ubstring((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyuencode_qYscCstdd�|D��S(Ncss|]}tt|�VqdS(N(ulenu_q_byte_map(u.0ux((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyu	<genexpr>]sulen_q.<locals>.<genexpr>(usum(ubstring((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyulen_q\scCsg}t|�d}|rJ|jtj��|ddd|�}n|}ytj|dd
�|fSWn�tjk
rtj	�g}xydD]e}y%tj|d|dd�|fSWq�tjk
r�|dkr�|jtj��nYq�Xq�Wtd	��YnXdS(
Nis===uvalidateiiiis=uunexpected binascii.ErrorT(iiiiF(ulenuappenduerrorsuInvalidBase64PaddingDefectubase64u	b64decodeuTrueubinasciiuErroruInvalidBase64CharactersDefectuFalseuAssertionError(uencodedudefectsupad_errupadded_encodedui((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyudecode_bds"
%cCstj|�jd�S(Nuascii(ubase64u	b64encodeudecode(ubstring((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyuencode_b~scCs3tt|�d�\}}|d|r.dndS(Niii(udivmodulen(ubstringugroups_of_3uleftover((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyulen_b�suqubc	Cs*|jd�\}}}}}|jd�\}}}|j�}|jdd�}t||�\}}y|j|�}Wn�tk
r�|jtj	dj
|���|j|d�}YnXtk
r|jdd�}|j�dkr|jtjdj
|���nYnX||||fS(u�Decode encoded word and return (string, charset, lang, defects) tuple.

    An RFC 2047/2243 encoded word has the form:

        =?charset*lang?cte?encoded_string?=

    where '*lang' may be omitted but the other parts may not be.

    This function expects exactly such a string (that is, it does not check the
    syntax and may raise errors if the string is not well formed), and returns
    the encoded_string decoded first from its Content Transfer Encoding and
    then from the resulting bytes into unicode using the specified charset.  If
    the cte-decoded string does not successfully decode using the specified
    character set, a defect is added to the defects list and the unknown octets
    are replaced by the unicode 'unknown' character ﷿.

    The specified charset and language are returned.  The default for language,
    which is rarely if ever encountered, is the empty string.

    u?u*uasciiusurrogateescapeu:Encoded word contains bytes not decodable using {} charsetuunknown-8bitu<Unknown charset {} in encoded word; decoded as unknown bytes(
usplitu	partitionuloweruencodeu
_cte_decodersudecodeuUnicodeErroruappenduerrorsuUndecodableBytesDefectuformatuLookupErroruCharsetError(	uewu_ucharsetucteu
cte_stringulangubstringudefectsustring((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyudecode�s"


uutf-8ucCs�|dkr!|jdd�}n|j|�}|d	kr{td|�}td|�}||dkrrdnd}nt||�}|r�d|}ndj||||�S(
uEncode string using the CTE encoding that produces the shorter result.

    Produces an RFC 2047/2243 encoded word of the form:

        =?charset*lang?cte?encoded_string?=

    where '*lang' is omitted unless the 'lang' parameter is given a value.
    Optional argument charset (defaults to utf-8) specifies the charset to use
    to encode the string to binary before CTE encoding it.  Optional argument
    'encoding' is the cte specifier for the encoding that should be used ('q'
    or 'b'); if it is None (the default) the encoding which produces the
    shortest encoded sequence is used, except that 'q' is preferred if it is up
    to five characters longer.  Optional argument 'lang' (default '') gives the
    RFC 2243 language string to specify in the encoded word.

    uunknown-8bituasciiusurrogateescapeuqubiu*u=?{}{}?{}?{}?=N(uencodeuNoneu_cte_encode_lengthu
_cte_encodersuformat(ustringucharsetuencodingulangubstringuqlenublenuencoded((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyuencode�s
(u__doc__ureubase64ubinasciiu	functoolsustringu
ascii_lettersudigitsuemailuerrorsu__all__upartialucompileusubu_q_byte_subberudecode_qudictu	_QByteMapu_q_byte_mapuorduencode_qulen_qudecode_buencode_bulen_bu
_cte_decodersudecodeu
_cte_encodersu_cte_encode_lengthuNoneuencode(((u9/opt/alt/python33/lib64/python3.3/email/_encoded_words.pyu<module>sH$		
*