OwlCyberSecurity - MANAGER
Edit File: _encoded_words.cpython-37.pyc
B �����A�[� ������������������@���sF��d�Z�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlm Z �dd l Z dd lZdd lZdd l Z dd lmZmZ�ddlmZ�dd ddddddgZe �e �d�jdd���Zdd��ZG�dd��de�Ze��Zdeed�<�dd ��Zdd��Zdd��Zdd��Z d d��Z!eed!�Z"d"d��Z#ee d!�Z$ee!d!�Z%d&d%d�Z&d S�)'z� 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. �����)�unicode_literals)�division)�absolute_import)�bytes)�chr)�int)�strN)� ascii_letters�digits)�errors�decode_q�encode_q�decode_b�encode_b�len_q�len_b�decode�encodes���=([a-fA-F0-9]{2})c�������������C���s���t�t|��d�d�g�S�)N��������)r���r����group)�m��r����V/opt/alt/python37/lib/python3.7/site-packages/future/backports/email/_encoded_words.py�<lambda>H��������r���c�������������C���s���t�|��dd��}�t|��g�fS�)N����_���� )r����replace�_q_byte_subber)�encodedr���r���r���r���J���s����c���������������@���s0���e�Zd�Zede�d��e�d���Zdd��ZdS�)� _QByteMaps���-!*+/�asciic�������������C���s.���||�j�krt|�|�|<�nd�|�|�|<�|�|�S�)Nz={:02X})�safer����format)�self�keyr���r���r����__missing__T���s���� z_QByteMap.__missing__N) �__name__� __module__�__qualname__r���r ���r���r ���r#���r'���r���r���r���r���r!���P���s���r!����_� c�������������C���s���t�d�dd��t|��D����S�)N��c�������������s���s���|�]}t�|�V��qd�S�)N)�_q_byte_map)�.0�xr���r���r���� <genexpr>a���s����zencode_q.<locals>.<genexpr>)r����joinr���)�bstringr���r���r���r ���`���s����c�������������C���s���t�dd��t|��D���S�)Nc�������������s���s���|�]}t�t|��V��qd�S�)N)�lenr.���)r/���r0���r���r���r���r1���d���s����zlen_q.<locals>.<genexpr>)�sumr���)r3���r���r���r���r���c���s����c���������� ���C���s����g�}t�|��d�}|r8|�t�����|�dd�d|����}n|�}y$t�d|�sTt�d��t� |�|fS��tjk r����t� ��g}x\dD�]L}yt� |�d|���|fS��tjtfk r����|dkr�|�t�����Y�q�X�q�W�td��Y�nX�d�S�) N����s���===s���^[A-Za-z0-9+/]*={0,2}$zNon-base64 digit found)r���r���������������=r���zunexpected binascii.Error) r4����appendr����InvalidBase64PaddingDefect�re�match�binascii�Error�base64� b64decode�InvalidBase64CharactersDefect� TypeError�AssertionError)r ����defects�pad_errZpadded_encoded�ir���r���r���r���k���s&���� c�������������C���s���t��|���d�S�)Nr"���)r@���� b64encoder���)r3���r���r���r���r�������s����c�������������C���s&���t�t|��d�\}}|d�|r dnd�S�)Nr8���r6���r���)�divmodr4���)r3����groups_of_3�leftoverr���r���r���r�������s����)�q�bc������� ��� ���C���s����t�|���d�\}}}}}|�d�\}}}|���}|�dd�}t|�|�\}}y|�|�}W�nv�tk r����|�t � d�|����|�|d�}Y�nB�tk r����|�dd�}|���dkr�|�t � d�|����Y�nX�||||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. �?�*r"����surrogateescapez:Encoded word contains bytes not decodable using {} charsetzunknown-8bitz<Unknown charset {} in encoded word; decoded as unknown bytes)r����split� partition�lowerr���� _cte_decodersr����UnicodeErrorr:���r����UndecodableBytesDefectr$����LookupError�CharsetError) �ewr+����charset�cte� cte_string�langr3���rE����stringr���r���r���r�������s"���� �utf-8r-���c�������������C���s����t�|��}�|dkr|��dd�}n |��|�}|dkr\td�|�}td�|�}||�dk�rXdnd}t|�|�}|rtd|�}d �||||�S�) a��Encode 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. zunknown-8bitr"���rP���NrL���rM�������rO���z=?{0}{1}?{2}?{3}?=)r���r����_cte_encode_length� _cte_encodersr$���)r^���rZ����encodingr]���r3����qlen�blenr ���r���r���r���r�������s���� )r_���Nr-���)'�__doc__� __future__r���r���r���Zfuture.builtinsr���r���r���r���r<���r@���r>���� functoolsr^���r ���r ���Zfuture.backports.emailr����__all__�partial�compile�subr���r����dictr!���r.����ordr ���r���r���r���r���rT���r���rb���ra���r���r���r���r���r����<module>���sP���$ +