/usr/lib/python3.10/email/__pycache__
NameSizeModeActions
base64mime.cpython-310.pyc32400644editdlrm
charset.cpython-310.pyc115750644editdlrm
contentmanager.cpython-310.pyc73890644editdlrm
encoders.cpython-310.pyc16270644editdlrm
errors.cpython-310.pyc58500644editdlrm
feedparser.cpython-310.pyc105780644editdlrm
generator.cpython-310.pyc132000644editdlrm
header.cpython-310.pyc164620644editdlrm
headerregistry.cpython-310.pyc219050644editdlrm
iterators.cpython-310.pyc19680644editdlrm
message.cpython-310.pyc378040644editdlrm
parser.cpython-310.pyc56730644editdlrm
policy.cpython-310.pyc96530644editdlrm
quoprimime.cpython-310.pyc76230644editdlrm
utils.cpython-310.pyc118660644editdlrm
_encoded_words.cpython-310.pyc57400644editdlrm
_header_value_parser.cpython-310.pyc784540644editdlrm
_parseaddr.cpython-310.pyc125120644editdlrm
_policybase.cpython-310.pyc152400644editdlrm
__init__.cpython-310.pyc15600644editdlrm
Edit: /usr/lib/python3.10/email/__pycache__/generator.cpython-310.pyc (13200B)
o …9jœSã@sêdZgd¢ZddlZddlZddlZddlZddlmZddlm Z m Z ddl m Z ddl mZdZd Ze d ¡Ze d ej¡Ze d ¡Ze d ¡ZGdd„dƒZGdd„deƒZdZGdd„deƒZeeejdƒƒZdeZej Z dS)z:Classes to generate plain text from a message object tree.)Ú GeneratorÚDecodedGeneratorÚBytesGeneratoréN)Údeepcopy)ÚStringIOÚBytesIO)Ú_has_surrogates)ÚHeaderWriteErrorÚ_Ú z \r\n|\r|\nz^From z\r\n[^ \t]|\r[^ \n\t]|\n[^ \t]s\r\n[^ \t]|\r[^ \n\t]|\n[^ \t]c@s°eZdZdZd'ddœdd„Zdd„Zd(d d „Zd d „Zd d„Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„ZeZdd„Zdd„Zdd „Zd!d"„Zed)d#d$„ƒZed%d&„ƒZdS)*rzŠGenerates output from a Message object tree. This basic generator writes the message to the given file object as plain text. N©ÚpolicycCs6|dur |dur dn|j}||_||_||_||_dS)aõCreate the generator for message flattening. outfp is the output file-like object for writing the message to. It must have a write() method. Optional mangle_from_ is a flag that, when True (the default if policy is not set), escapes From_ lines in the body of the message by putting a `>' in front of them. Optional maxheaderlen specifies the longest length for a non-continued header. When a header line is longer (in characters, with tabs expanded to 8 spaces) than maxheaderlen, the header will split as defined in the Header class. Set maxheaderlen to zero to disable header wrapping. The default is 78, as recommended (but not required) by RFC 2822. The policy keyword specifies a policy object that controls a number of aspects of the generator's operation. If no policy is specified, the policy associated with the Message object passed to the flatten method is used. NT)Ú mangle_from_Ú_fpÚ _mangle_from_Ú maxheaderlenr )ÚselfÚoutfprrr ©rú&/usr/lib/python3.10/email/generator.pyÚ__init__'s  zGenerator.__init__cCs|j |¡dS©N)rÚwrite©rÚsrrrrGszGenerator.writeFcCsâ|jdur|jn|j}|dur|j|d}|jdur!|j|jd}|j|_| |j¡|_d|_| |j¡|_|j}|j}z-||_||_|r\|  ¡}|sTdt   t   ¡¡}|  ||j¡|  |¡W||_||_dS||_||_w)aÿPrint the message object tree rooted at msg to the output file specified when the Generator instance was created. unixfrom is a flag that forces the printing of a Unix From_ delimiter before the first object in the message tree. If the original message has no From_ delimiter, a `standard' one is crafted. By default, this is False to inhibit the printing of any From_ delimiter. Note that for subobjects, no From_ line is printed. linesep specifies the characters used to indicate a new line in the output. The default value is determined by the policy specified when the Generator instance was created or, if none was specified, from the policy associated with the msg. N)Úlinesep©Úmax_line_lengthÚz From nobody )r ÚclonerrÚ_NLÚ_encodeÚ _encoded_NLÚ_EMPTYÚ_encoded_EMPTYÚ get_unixfromÚtimeÚctimerÚ_write)rÚmsgÚunixfromrr Úold_gen_policyÚold_msg_policyÚufromrrrÚflattenKs0    ÿzGenerator.flattencCs|j||jd|jdS)z1Clone this generator with the exact same options.Nr )Ú __class__rr )rÚfprrrr|s ýzGenerator.clonecCótƒSr)r©rrrrÚ _new_bufferszGenerator._new_buffercCs|Srrrrrrr!”szGenerator._encodecCsX|sdSt |¡}|dd…D] }| |¡| |j¡q|dr*| |d¡dSdS)Néÿÿÿÿ)ÚNLCREÚsplitrr )rÚlinesÚlinerrrÚ _write_lines˜s  ÿzGenerator._write_linescCsÐ|j}zd|_| ¡|_}| |¡W||_|j}|`n ||_|j}|`w|rJt|ƒ}| d¡dur:|d|d<n| d|d¡| d|d¡t|ddƒ}|durZ| |¡n||ƒ|j  |  ¡¡dS)Núcontent-transfer-encodingrúContent-Transfer-Encodingú content-typeéÚ_write_headers) rÚ _munge_cter3Ú _dispatchrÚgetÚreplace_headerÚgetattrr>rÚgetvalue)rr)ÚoldfpÚsfpÚ munge_cteÚmethrrrr(¨s,  þ  zGenerator._writecCst| ¡}| ¡}t ||f¡ dd¡}t|d|dƒ}|dur4| dd¡}t|d|dƒ}|dur4|j}||ƒdS)Nú-r Ú_handle_)Úget_content_maintypeÚget_content_subtypeÚ UNDERSCOREÚjoinÚreplacerCÚ _writeBody)rr)ÚmainÚsubÚspecificrHÚgenericrrrr@Ïs  zGenerator._dispatchcCsŠ| ¡D]8\}}|j ||¡}|jjr7|jj}| |jj¡s(td|›d|›ƒ‚t |  |¡¡r7td|›ƒ‚|  |¡q|  |j ¡dS©Nz folded header does not end with z: z folded header contains newline: ) Ú raw_itemsr ÚfoldÚverify_generated_headersrÚendswithr ÚNEWLINE_WITHOUT_FWSPÚsearchÚ removesuffixrr ©rr)ÚhÚvÚfoldedrrrrr>ãsÿÿ zGenerator._write_headerscCsž| ¡}|dur dSt|tƒstdt|ƒƒ‚t|jƒr?| d¡}|dur?t|ƒ}|d=|  ||¡| ¡}|d|df|_ |j rHt   d|¡}| |¡dS)Nzstring payload expected: %sÚcharsetr:r<ú>From )Ú get_payloadÚ isinstanceÚstrÚ TypeErrorÚtyperÚ_payloadÚ get_paramrÚ set_payloadr?rÚfcrerRr9)rr)ÚpayloadrarrrÚ _handle_textös$    ÿ zGenerator._handle_textc Cs–g}| ¡}|dur g}nt|tƒr| |¡dSt|tƒs!|g}|D]}| ¡}| |¡}|j|d|jd|  |  ¡¡q#|  ¡}|sU|j   |¡}| |¡}| |¡|jdurs|jret d|j¡} n|j} | | ¡| |j¡| d||j¡|rˆ|j | d¡¡|D]} | |jd||j¡|j | ¡qŠ| |jd|d|j¡|jdurÉ|jr¿t d|j¡} n|j} | | ¡dSdS)NF©r*rrbz--r)rcrdrerÚlistr3rr.r ÚappendrDÚ get_boundaryr"rNÚ_make_boundaryÚ set_boundaryÚpreamblerrkrRr9rÚpopÚepilogue) rr)ÚmsgtextsÚsubpartsÚpartrÚgÚboundaryÚalltextrtÚ body_partrvrrrÚ_handle_multipartsL           ûzGenerator._handle_multipartcCs4|j}|jdd|_z | |¡W||_dS||_w)Nrr)r rr~)rr)ÚprrrÚ_handle_multipart_signedHs  z"Generator._handle_multipart_signedcCsšg}| ¡D]:}| ¡}| |¡}|j|d|jd| ¡}| |j¡}|r;|d|jkr;|  |j  |dd…¡¡q|  |¡q|j   |j  |¡¡dS)NFrnr4) rcr3rr.r rDr6r"r$rprNrr)rr)ÚblocksryrrzÚtextr7rrrÚ_handle_message_delivery_statusSs    z)Generator._handle_message_delivery_statuscCs^| ¡}| |¡}|j}t|tƒr"|j| d¡d|jd| ¡}n|  |¡}|j   |¡dS)NrFrn) r3rrhrdror.rcr rDr!rr)rr)rrzrlrrrÚ_handle_messagehs    zGenerator._handle_messagecCsxt tj¡}dt|d}|dur|S|}d} | dt |¡dtj¡}|  |¡s/ |S|dt |ƒ}|d7}q) Nz===============z==rTz^--z(--)?$Ú.r=) ÚrandomÚ randrangeÚsysÚmaxsizeÚ_fmtÚ _compile_reÚreÚescapeÚ MULTILINEr[re)Úclsr‚Útokenr{ÚbÚcounterÚcrerrrrrs  þûzGenerator._make_boundarycCs t ||¡Sr)rŒÚcompile©rrÚflagsrrrr‹“s zGenerator._compile_re)NN)FNr)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr.rr3r!r9r(r@r>rmrPr~r€rƒr„Ú classmethodrrr‹rrrrrs0  ÿ 1':  rcsPeZdZdZdd„Zdd„Zdd„Zdd „Z‡fd d „ZeZ e d d „ƒZ ‡Z S)raþGenerates a bytes version of a Message object tree. Functionally identical to the base Generator except that the output is bytes and not string. When surrogates were used in the input to encode bytes, these are decoded back to bytes for output. If the policy has cte_type set to 7bit, then the message is transformed such that the non-ASCII bytes are properly content transfer encoded, using the charset unknown-8bit. The outfp object must accept bytes in its write method. cCs|j | dd¡¡dS)NÚasciiÚsurrogateescape)rrÚencoderrrrr¥szBytesGenerator.writecCr1r)rr2rrrr3¨szBytesGenerator._new_buffercCs | d¡S©Nrœ)ržrrrrr!«s zBytesGenerator._encodecCsŒ| ¡D]9\}}|j ||¡}|jjr7|jj ¡}| |¡s(td|›d|›ƒ‚t  |  |¡¡r7td|›ƒ‚|j   |¡q|  |j ¡dSrU)rVr Ú fold_binaryrXrržrYr ÚNEWLINE_WITHOUT_FWSP_BYTESr[r\rrr r]rrrr>®s  ÿÿzBytesGenerator._write_headerscs^|jdurdSt|jƒr%|jjdks%|jrt d|j¡|_| |j¡dStt |ƒ  |¡dS)NÚ7bitrb) rhrr Úcte_typerrkrRr9Úsuperrrm)rr)©r/rrrm¿s zBytesGenerator._handle_textcCst | d¡|¡SrŸ)rŒr”ržr•rrrr‹ÎszBytesGenerator._compile_re) r—r˜r™ršrr3r!r>rmrPr›r‹Ú __classcell__rrr¥rr˜s   rzD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c@s(eZdZdZdddœdd„Zdd„ZdS) rz±Generates a text representation of a message. Like the Generator base class, except that non-text parts are substituted with a format string representing the part. Nr cCs0tj|||||d|durt|_dS||_dS)aŒLike Generator.__init__() except that an additional optional argument is allowed. Walks through all subparts of a message. If the subpart is of main type `text', then it prints the decoded payload of the subpart. Otherwise, fmt is a format string that is used instead of the message payload. fmt is expanded with the following keywords (in %(keyword)s format): type : Full MIME type of the non-text part maintype : Main MIME type of the non-text part subtype : Sub-MIME type of the non-text part filename : Filename of the non-text part description: Description associated with the non-text part encoding : Content transfer encoding of the non-text part The default value for fmt is None, meaning [Non-text (%(type)s) part of message omitted, filename %(filename)s] r N)rrÚ_FMTrŠ)rrrrÚfmtr rrrrÜs ÿ  zDecodedGenerator.__init__c Cs„| ¡D];}| ¡}|dkrt|jdd|dq|dkrqt|j| ¡| ¡| ¡| d¡| dd¡| d d ¡d œ|dqdS) Nr‚F)Údecode)ÚfileÚ multipartz [no filename]zContent-Descriptionz[no description]r;z [no encoding])rgÚmaintypeÚsubtypeÚfilenameÚ descriptionÚencoding) ÚwalkrKÚprintrcrŠÚget_content_typerLÚ get_filenamerA)rr)ryr¬rrrr@ús* ÿÿù ÷øzDecodedGenerator._dispatch)NNN)r—r˜r™ršrr@rrrrrÖs  ÿ rr=z%%0%dd)!ršÚ__all__rŒrˆr&r†ÚcopyrÚiorrÚ email.utilsrÚ email.errorsr rMÚNLr”r5rŽrkrZr¡rrr§rÚlenÚreprr‰Ú_widthrŠrrrrrrÚs2      }<;