U e5dL!@sddlZddlZddlZddlZddlmZmZddlmZdddddd d d gZ e e d j d dZ ddZGdddeZeZdeed<ddZddZddZddZdd ZeedZdd ZeedZeedZddd ZdS)N) ascii_lettersdigits)errorsdecode_qencode_qdecode_bencode_blen_qlen_bdecodeencodes=([a-fA-F0-9]{2})cCst|dS)N)bytesfromhexgroupr )mr,/usr/lib64/python3.8/email/_encoded_words.pyArcCs|dd}t|gfS)N_ )replace_q_byte_subber)encodedrrrrCs c@s,eZdZdededZddZdS) _QByteMaps-!*+/asciicCs.||jkrt|||<nd|||<||S)Nz={:02X})safechrformat)selfkeyrrr __missing__Ms z_QByteMap.__missing__N)__name__ __module__ __qualname__rr rrr"rrrrrIsr_ cCsddd|DS)Ncss|]}t|VqdSN) _q_byte_map.0xrrr Zszencode_q..)joinbstringrrrrYscCstdd|DS)Ncss|]}tt|VqdSr))lenr*r+rrrr.]szlen_q..)sumr0rrrr \scCst|d}|r ddd|nd}z&tj||dd|rDtgngfWStjk rztj|ddtgfWYStjk rz,tj|dddttgfWYYStjk r|tgfYYYSXYnXYnXdS)Ns===rT)ZvalidateFs==) r2base64Z b64decoderZInvalidBase64PaddingDefectbinasciiErrorZInvalidBase64CharactersDefectZInvalidBase64LengthDefect)rZpad_errZmissing_paddingrrrrds(   cCst|dS)Nr)r5Z b64encoder r0rrrrscCs&tt|d\}}|d|r dndS)Nr4r)divmodr2)r1Z groups_of_3Zleftoverrrrr s)qbc Cs|d\}}}}}|d\}}}|}|dd}t||\}}z||}Wnvtk r|t d |||d}YnBt k r|dd}|dkr|t d |YnX||||fS)N?*rsurrogateescapez:Encoded word contains bytes not decodable using {} charset unknown-8bitzr:r;r=z=?{}{}?{}?{}?=)r _cte_encode_length _cte_encodersr)rIrGencodingrHr1ZqlenZblenrrrrr s    )rJNr()rer5r6 functoolsrIrrZemailr__all__partialcompilesubrrdictrr*ordrr rrr rCr rMrLr rrrr*sJ   &+