选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
3 å]€iÿPã@sâdZdddgZddlZddlZddlZddlZddlmZddlm Z m Z ddl m Z dd l mZd Zd Zejd ƒZejd ejƒZejdƒZGdd„dƒZGdd„deƒZdZGdd„deƒZeeejdƒƒZdeZejZdS)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]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|dkr|dkrdn|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Úoutfpr rr ©rú'/usr/lib64/python3.6/email/generator.pyÚ__init__&s zGenerator.__init__cCs|jj|ƒdS)N)rÚwrite)rÚsrrrrFszGenerator.writeFc CsØ|jdkr|jn|j}|dk r*|j|d�}|jdk rB|j|jd�}|j|_|j|jƒ|_d|_|j|jƒ|_|j}|j}zL||_||_|r¸|j ƒ}|s¨dt j t j ƒƒ}|j ||jƒ|j |ƒWd||_||_XdS)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_NLZ_EMPTYÚ_encoded_EMPTYZ get_unixfromÚtimeZctimerÚ_write)rÚmsgÚunixfromrr Zold_gen_policyZold_msg_policyZufromrrrÚflattenJs,  zGenerator.flattencCs|j||jd|jd�S)z1Clone this generator with the exact same options.N)r )Ú __class__rr )rÚfprrrr{szGenerator.clonecCstƒS)N)r)rrrrÚ _new_buffer�szGenerator._new_buffercCs|S)Nr)rrrrrr“szGenerator._encodecCsX|sdStj|ƒ}x*|dd…D]}|j|ƒ|j|jƒq W|drT|j|dƒdS)Nééÿÿÿÿr)r))ÚNLCREÚsplitrr)rÚlinesÚlinerrrÚ _write_lines—s  zGenerator._write_linesc Cs¤|j}z"d|_|jƒ|_}|j|ƒWd||_|j}|`X|rht|ƒ}|jd|dƒ|jd|dƒt|ddƒ}|dkrˆ|j|ƒn||ƒ|jj|j ƒƒdS)Nzcontent-transfer-encodingrz content-typer(Ú_write_headers) rÚ _munge_cter'Ú _dispatchrZreplace_headerÚgetattrr/rÚgetvalue)rr"ZoldfpZsfpZ munge_cteÚmethrrrr!§s"   zGenerator._writecCst|jƒ}|jƒ}tj||fƒjddƒ}t|d|dƒ}|dkrh|jddƒ}t|d|dƒ}|dkrh|j}||ƒdS)Nú-r Z_handle_)Úget_content_maintypeÚget_content_subtypeÚ UNDERSCOREÚjoinÚreplacer2Ú _writeBody)rr"ÚmainÚsubZspecificr4Zgenericrrrr1Ês zGenerator._dispatchcCs¨x–|jƒD]Š\}}|jj||ƒ}|jjrŠ|jj}|j|jjƒsRtd|›d|›�ƒ‚|}|j|ƒrr|dt|ƒ …}tj |ƒrŠtd|›�ƒ‚|j |ƒq W|j |j ƒdS)Nz folded header does not end with z: z folded header contains newline: ) Ú raw_itemsr ZfoldZverify_generated_headersrÚendswithr ÚlenÚNEWLINE_WITHOUT_FWSPÚsearchrr)rr"ÚhÚvZfoldedrZfolded_no_lineseprrrr/Þs   zGenerator._write_headerscCsž|jƒ}|dkrdSt|tƒs.tdt|ƒƒ‚t|jƒr~|jdƒ}|dk r~t|ƒ}|d=|j ||ƒ|jƒ}|d|df|_ |j r�t j d|ƒ}|j|ƒdS)Nzstring payload expected: %sÚcharsetzcontent-transfer-encodingz content-typez>From )Ú get_payloadÚ isinstanceÚstrÚ TypeErrorÚtyperÚ_payloadZ get_paramrZ set_payloadr0rÚfcrer=r.)rr"ÚpayloadrErrrÚ _handle_textôs"      zGenerator._handle_textc Cs¢g}|jƒ}|dkrg}n(t|tƒr2|j|ƒdSt|tƒsB|g}x>|D]6}|jƒ}|j|ƒ}|j|d|jd�|j |j ƒƒqHW|j ƒ}|s®|j j |ƒ}|j|ƒ}|j|ƒ|jdk rê|jrÎtjd|jƒ} n|j} |j| ƒ|j|jƒ|jd||jƒ|�r|jj|jdƒƒx4|D],} |j|jd||jƒ|jj| ƒ�qW|j|jd|d|jƒ|jdk �rž|j�rŽtjd|jƒ} n|j} |j| ƒdS)NF)r#rz>From z--r)rFrGrHrÚlistr'rr$rÚappendr3Z get_boundaryrr9Ú_make_boundaryZ set_boundaryÚpreamblerrLr=r.rÚpopÚepilogue) rr"ZmsgtextsZsubpartsÚpartrÚgÚboundaryZalltextrRZ body_partrTrrrÚ_handle_multipart sJ             zGenerator._handle_multipartc Cs0|j}|jdd�|_z|j|ƒWd||_XdS)Nr)r)r rrX)rr"ÚprrrÚ_handle_multipart_signedFs z"Generator._handle_multipart_signedcCsžg}x€|jƒD]t}|jƒ}|j|ƒ}|j|d|jd�|jƒ}|j|jƒ}|rx|d|jkrx|j |jj |dd…ƒƒq|j |ƒqW|j j |jj |ƒƒdS)NF)r#rr(r)r)) rFr'rr$rr3r+rrrPr9rr)rr"ZblocksrUrrVÚtextr,rrrÚ_handle_message_delivery_statusQs  z)Generator._handle_message_delivery_statuscCs^|jƒ}|j|ƒ}|j}t|tƒrD|j|jdƒd|jd�|jƒ}n |j |ƒ}|j j |ƒdS)NrF)r#r) r'rrKrGrOr$rFrr3rrr)rr"rrVrMrrrÚ_handle_messagefs    zGenerator._handle_messagecCsztjtjƒ}d t|d}|dkr(|S|}d}xD|jdtj|ƒdtjƒ}|j |ƒsZP|dt |ƒ}|d7}q2W|S) Nú=éz==rz^--z(--)?$Ú.r(z===============) ÚrandomZ randrangeÚsysÚmaxsizeÚ_fmtÚ _compile_reÚreÚescapeÚ MULTILINErBrH)Úclsr[ÚtokenrWÚbZcounterZcrerrrrQs   zGenerator._make_boundarycCs tj||ƒS)N)rfÚcompile)rirÚflagsrrrre‘szGenerator._compile_re)NN)FN)N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr$rr'rr.r!r1r/rNr;rXrZr\r]Ú classmethodrQrerrrrrs* 1#:  csPeZdZdZdd„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|jj|jddƒƒdS)NÚasciiÚsurrogateescape)rrÚencode)rrrrrr£szBytesGenerator.writecCstƒS)N)r)rrrrr'¦szBytesGenerator._new_buffercCs |jdƒS)Nrs)ru)rrrrrr©szBytesGenerator._encodecCs<x*|jƒD]\}}|jj|jj||ƒƒq W|j|jƒdS)N)r>rrr Z fold_binaryr)rr"rCrDrrrr/¬szBytesGenerator._write_headerscs^|jdkrdSt|jƒrJ|jjdk rJ|jrFrom ) rKrr Zcte_typerrLr=r.ÚsuperrrN)rr")r%rrrN´s zBytesGenerator._handle_textcCstj|jdƒ|ƒS)Nrs)rfrlru)rirrmrrrreÃszBytesGenerator._compile_re) rnrorprqrr'rr/rNr;rrreÚ __classcell__rr)r%rr–s  zD[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. N)r cCs.tj|||||d�|dkr$t|_n||_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Ú_FMTrd)rrr rZfmtr rrrrÑs  zDecodedGenerator.__init__c Csˆx‚|jƒD]v}|jƒ}|dkr4t|jdd�|d�q |dkr>q t|j|jƒ|jƒ|jƒ|jdƒ|jddƒ|jd d ƒd œ|d�q WdS) Nr[F)Údecode)ÚfileZ multipartz [no filename]zContent-Descriptionz[no description]zContent-Transfer-Encodingz [no encoding])rJÚmaintypeÚsubtypeÚfilenameZ descriptionÚencoding) Úwalkr6ÚprintrFrdZget_content_typer7Ú get_filenameÚget)rr"rUr{rrrr1ïs  zDecodedGenerator._dispatch)NNN)rnrorprqrr1rrrrrËsr(z%%0%dd) rqÚ__all__rfrbr raÚcopyrÚiorrZ email.utilsrZ email.errorsr r8ÚNLrlr*rhrLrArrrxrr@ÚreprrcZ_widthrdrQrrrrÚs.      |3;