bg dZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z dd l Z dd l Z dd l Z dd l Z dd lmZmZdd lmZgd Ze je jd jdZdZGddeZeZdeed<dZdZdZdZ dZ!eedZ"dZ#ee dZ$ee!dZ%ddZ&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_lettersdigits)errors)decode_qencode_qdecode_bencode_blen_qlen_bdecodeencodes=([a-fA-F0-9]{2})cdtt|ddgS)N)rrgroup)ms v/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/future/backports/email/_encoded_words.pyrHs%%QWWQZZ,,-..cjt|dd}t|gfS)N_ )rreplace_q_byte_subber)encodeds rr r Js0GOOD$//00G ' " "B &&rcneZdZedejdzejdzZdZdS) _QByteMaps-!*+/asciicz||jvrt|||<nd|||<||S)Nz={:02X})saferformat)selfkeys r __missing__z_QByteMap.__missing__TsA $)  CDII!((--DICyrN) __name__ __module__ __qualname__rr rr r'r+rrr$r$PsV 50M0999MFM'zencode_q..as&>>!{1~>>>>>>r)r joinrbstrings rrr`s1 rww>>uW~~>>>>> ? ??rcNtdt|DS)Nc3JK|]}tt|VdSr5)lenr6r7s rr:zlen_q..ds.;;qs;q>"";;;;;;r)sumrr<s rrrcs% ;;E'NN;;; ; ;;rcfg}t|dz}|r7|tj|ddd|z z}n|} t jd|st jdtj ||fS#t j$rtj g}dD]j} tj |d|zz|fccYS#t jtf$r/|dkr&|tjYgwxYwtdwxYw) Ns===s^[A-Za-z0-9+/]*={0,2}$zNon-base64 digit found)rr=rzunexpected binascii.Error) r@appendr InvalidBase64PaddingDefectrematchbinasciiErrorbase64 b64decodeInvalidBase64CharactersDefect TypeErrorAssertionError)r"defectspad_errpadded_encodedis rrrkseG'llQG!v8::;;; 6*1W9*#55 >x1>BB ;.!9:: ://88 >>>>799: > >A H'Q77@@@@@@NI. H H Ha44NN6#D#F#FGGG H !!<== =>s1>B'D08CD0ADD0DD0cPtj|dS)Nr%)rM b64encoderr<s rrrs!  G $ $ + +G 4 44rcZtt|d\}}|dz|rdndzS)NrErCr)divmodr@)r= groups_of_3leftovers rrrs4"3w<<33K ?82aa 33r)qbct|d\}}}}}|d\}}}|}|dd}t ||\}} ||}n#t$rS|tj d |||d}Ynwt$rk|dd}|dkr:|tj d |YnwxYw||||fS)uDecode 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 {} charset unknown-8bitzrs; ('''''&&&&&&!!!!!!H (((((((())))))   #":2:.C#D#D#H..00'''        ikk  CCHH@@@<<<>>>:555444   '*'*'*V     IIIIIIr