3 \(@sddlZddlmZmZmZmZddlmZddlm Z ddl m Z ddl m Z ddd d d d d dgZejdZeGdd d eZeZe`ejddZejddZejdddZejddZdS)N)PolicyCompat32compat32_extend_docstrings)_has_surrogates)HeaderRegistry)raw_data_manager) EmailMessagerrr EmailPolicydefaultstrictSMTPHTTPz\n|\rcsleZdZeZdZdZeZe Z fddZ ddZ ddZ d d Zd d Zd dZddZdddZZS)r Flongc s*d|krtj|dttjf|dS)Nheader_factory)object __setattr__rsuper__init__)selfkw) __class__$/usr/lib64/python3.6/email/policy.pyr\szEmailPolicy.__init__cCs |j|jS)N)rZ max_count)rnamerrrheader_max_countcszEmailPolicy.header_max_countcCs>|djdd\}}|jddj|dd}||jdfS)Nr:z z )splitlstripjoinrstrip)rZ sourcelinesrvaluerrrheader_source_parseus zEmailPolicy.header_source_parsecCsVt|dr$|jj|jkr$||fSt|trFt|jdkrFtd||j||fS)NrrzDHeader values may not contain linefeed or carriage return characters) hasattrrlower isinstancestrlen splitlines ValueErrorr)rrr#rrrheader_store_parses zEmailPolicy.header_store_parsecCs*t|dr|Sdjtj|}|j||S)Nrr)r%r!linesep_splitterrr)rrr#rrrheader_fetch_parses zEmailPolicy.header_fetch_parsecCs|j||ddS)NT) refold_binary)_fold)rrr#rrrfoldszEmailPolicy.foldcCs0|j|||jdkd}|jr dnd}|j|dS)NZ7bit)r/utf8asciisurrogateescape)r0Zcte_typer2encode)rrr#Zfoldedcharsetrrr fold_binaryszEmailPolicy.fold_binarycst|dr|j|dS|jr"|jntd|j}|jdkp|jdko|rft|dt|dkptfdd |d dD}|s|rt|r|j |d j |j|dS|d |j j ||j S) Nr)Zpolicyinfallrrc3s|]}t|kVqdS)N)r)).0x)maxlenrr sz$EmailPolicy._fold..rrz: ) r%r1max_line_lengthfloatr* refold_sourcer)anyrrr!linesep)rrr#r/linesZrefoldr)r=rr0s     zEmailPolicy._fold)F)__name__ __module__ __qualname__r Zmessage_factoryr2rArrrZcontent_managerrrr$r,r.r1r7r0 __classcell__rr)rrr s=  T)Zraise_on_defectz )rC)rCr?)r2)reZemail._policybaserrrrZ email.utilsrZemail.headerregistryrZemail.contentmanagerrZ email.messager __all__compiler-r r rZcloner r rZSMTPUTF8rrrrs.      @