[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@3.145.40.120: ~ $
U

��,aϡ�	@s�ddlZddlZddlZddlmZddlmZddlmZ	ddlm
Z
ddlmZed�Z
e
ed�BZed	�Zee
BZeed
�Zeed�Zeed�Bed
�Zee
BZeed
�BZee
BZeed�Zdd�Ze�dejejB�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"Gdd�de�Z#Gdd�de�Z$Gd d!�d!e�Z%Gd"d#�d#e�Z&Gd$d%�d%e�Z'Gd&d'�d'e'�Z(Gd(d)�d)e�Z)Gd*d+�d+e�Z*Gd,d-�d-e�Z+Gd.d/�d/e�Z,Gd0d1�d1e�Z-Gd2d3�d3e�Z.Gd4d5�d5e�Z/Gd6d7�d7e�Z0Gd8d9�d9e�Z1Gd:d;�d;e�Z2Gd<d=�d=e�Z3Gd>d?�d?e�Z4Gd@dA�dAe�Z5GdBdC�dCe�Z6GdDdE�dEe�Z7GdFdG�dGe�Z8GdHdI�dIe�Z9GdJdK�dKe!�Z:GdLdM�dMe�Z;GdNdO�dOe�Z<GdPdQ�dQe�Z=GdRdS�dSe�Z>GdTdU�dUe>�Z?GdVdW�dWe�Z@GdXdY�dYe�ZAGdZd[�d[e�ZBGd\d]�d]e�ZCGd^d_�d_e�ZDGd`da�daeD�ZEGdbdc�dceD�ZFGddde�dee�ZGGdfdg�dge�ZHGdhdi�die�ZIGdjdk�dkeI�ZJGdldm�dmeJ�ZKGdndo�doe�ZLGdpdq�dqeM�ZNGdrds�dseN�ZOGdtdu�dueN�ZPGdvdw�dweO�ZQGdxdy�dye
jR�ZSePd
dz�ZTePd{d|�ZUePd}d~�ZVe�d�Wd��Xe
���jYZZe�d��We�[d��Xe����j\Z]e�d��j^Z_e�d��We�[d��Xe����j\Z`e�d��We�[d��Xe����j\Zae�d��We�[d��Xe����j\Zbd�d��Zcd�d��Zdd�d��Zed�d��Zfd�d��Zgd�d��Zhd�d��Zid�d��Zjd�d��Zkd�d��Zld�d��Zmd�d��Znd�d��Zod�d��Zpd�d��Zqd�d��Zrd�d��Zsd�d��Ztd�d��Zud�d��Zvd�d��Zwd�d��Zxd�d��Zyd�d��Zzd�d��Z{d�d��Z|d�d��Z}d�d��Z~d�d��Zd�d��Z�d�d��Z�d�d„Z�d�dĄZ�d�dƄZ�d�dȄZ�d�dʄZ�d�d̄Z�d�d΄Z�d�dЄZ�d�d҄Z�d�dԄZ�d�dքZ�d�d؄Z�d�dڄZ�d�d܄Z�d�dބZ�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d�Z�d�d��Z�dS)��N)�	hexdigits)�
itemgetter)�_encoded_words)�errors)�utilsz 	�(z
()<>@,:;.\"[]�.z."(z/?=z*'%�%cCs dt|��dd��dd�dS)N�"�\�\\z\")�str�replace��value�r�?/opt/alt/python38/lib64/python3.8/email/_header_value_parser.py�quote_string`srz�
   =\?            # literal =?
   [^?]*          # charset
   \?             # literal ?
   [qQbB]         # literal 'q' or 'b', case insensitive
   \?             # literal ?
  .*?             # encoded word
  \?=             # literal ?=
cs�eZdZdZdZdZ�fdd�Zdd�Z�fdd�Ze	d	d
��Z
e	dd��Zd
d�Ze	dd��Z
e	dd��Zdd�Zddd�Zddd�Zddd�Z�ZS)�	TokenListNTcst�j||�g|_dS�N)�super�__init__�defects)�self�args�kw��	__class__rrryszTokenList.__init__cCsd�dd�|D��S)N�css|]}t|�VqdSr�r
��.0�xrrr�	<genexpr>~sz$TokenList.__str__.<locals>.<genexpr>��join�rrrr�__str__}szTokenList.__str__csd�|jjt����S�Nz{}({})��formatr�__name__r�__repr__r&rrrr,�s
�zTokenList.__repr__cCsd�dd�|D��S)Nrcss|]}|jr|jVqdSrrr rrrr#�sz"TokenList.value.<locals>.<genexpr>r$r&rrrr�szTokenList.valuecCstdd�|D�|j�S)Ncss|]}|jVqdSr)�all_defectsr rrrr#�sz(TokenList.all_defects.<locals>.<genexpr>)�sumrr&rrrr-�szTokenList.all_defectscCs|d��S�Nr)�startswith_fwsr&rrrr0�szTokenList.startswith_fwscCstdd�|D��S)Ncss|]}|jVqdSr)�
as_ew_allowed)r!�partrrrr#�sz*TokenList.as_ew_allowed.<locals>.<genexpr>)�allr&rrrr1�szTokenList.as_ew_allowedcCsg}|D]}|�|j�q|Sr)�extend�comments)rr5�tokenrrrr5�szTokenList.commentscCst||d�S)N��policy)�_refold_parse_tree�rr8rrr�fold�szTokenList.foldrcCst|j|d��dS)N��indent)�print�ppstr�rr=rrr�pprint�szTokenList.pprintcCsd�|j|d��S)N�
r<)r%�_ppr@rrrr?�szTokenList.ppstrccszd�||jj|j�V|D]4}t|d�s:|d�|�Vq|�|d�EdHq|jrdd�|j�}nd}d�||�VdS)Nz{}{}/{}(rCz*    !! invalid element in token list: {!r}z    z Defects: {}rz{}){})r*rr+�
token_type�hasattrrCr)rr=r6ZextrarrrrC�s�
�
z
TokenList._pp)r)r)r)r+�
__module__�__qualname__rD�syntactic_break�ew_combine_allowedrr'r,�propertyrr-r0r1r5r;rAr?rC�
__classcell__rrrrrss&





rc@s$eZdZedd��Zedd��ZdS)�WhiteSpaceTokenListcCsdS�N� rr&rrrr�szWhiteSpaceTokenList.valuecCsdd�|D�S)NcSsg|]}|jdkr|j�qS)�comment)rD�contentr rrr�
<listcomp>�s
z0WhiteSpaceTokenList.comments.<locals>.<listcomp>rr&rrrr5�szWhiteSpaceTokenList.commentsN)r+rFrGrJrr5rrrrrL�s
rLc@seZdZdZdS)�UnstructuredTokenList�unstructuredN�r+rFrGrDrrrrrR�srRc@seZdZdZdS)�Phrase�phraseNrTrrrrrU�srUc@seZdZdZdS)�WordZwordNrTrrrrrW�srWc@seZdZdZdS)�CFWSList�cfwsNrTrrrrrX�srXc@seZdZdZdS)�Atom�atomNrTrrrrrZ�srZc@seZdZdZdZdS)�Tokenr6FN)r+rFrGrDZencode_as_ewrrrrr\�sr\c@seZdZdZdZdZdZdS)�EncodedWord�encoded-wordN)r+rFrGrD�cte�charset�langrrrrr]�sr]c@s4eZdZdZedd��Zedd��Zedd��ZdS)	�QuotedString�
quoted-stringcCs"|D]}|jdkr|jSqdS�N�bare-quoted-string�rDr�rr"rrrrP�s
zQuotedString.contentcCs>g}|D]*}|jdkr&|�t|��q|�|j�qd�|�S)Nrer)rD�appendr
rr%)r�resr"rrr�quoted_value�s
zQuotedString.quoted_valuecCs"|D]}|jdkr|jSqdSrdrf�rr6rrr�stripped_value�s
zQuotedString.stripped_valueN)r+rFrGrDrJrPrjrlrrrrrb�s

	rbc@s$eZdZdZdd�Zedd��ZdS)�BareQuotedStringrecCstd�dd�|D���S)Nrcss|]}t|�VqdSrrr rrrr#sz+BareQuotedString.__str__.<locals>.<genexpr>)rr%r&rrrr'�szBareQuotedString.__str__cCsd�dd�|D��S)Nrcss|]}t|�VqdSrrr rrrr#sz)BareQuotedString.value.<locals>.<genexpr>r$r&rrrrszBareQuotedString.valueN)r+rFrGrDr'rJrrrrrrm�srmc@s8eZdZdZdd�Zdd�Zedd��Zedd	��Zd
S)�CommentrOcs(d�tdg�fdd��D�dggg��S)Nrrcsg|]}��|��qSr)�quoter r&rrrQsz#Comment.__str__.<locals>.<listcomp>�))r%r.r&rr&rr's��zComment.__str__cCs2|jdkrt|�St|��dd��dd��dd�S)NrOrrrz\(rpz\))rDr
r)rrrrrros
��z
Comment.quotecCsd�dd�|D��S)Nrcss|]}t|�VqdSrrr rrrr#sz"Comment.content.<locals>.<genexpr>r$r&rrrrPszComment.contentcCs|jgSr)rPr&rrrr5szComment.commentsN)	r+rFrGrDr'rorJrPr5rrrrrns
rnc@s4eZdZdZedd��Zedd��Zedd��ZdS)	�AddressListzaddress-listcCsdd�|D�S)NcSsg|]}|jdkr|�qS)�address�rDr rrrrQ's
z)AddressList.addresses.<locals>.<listcomp>rr&rrr�	addresses%szAddressList.addressescCstdd�|D�g�S)Ncss|]}|jdkr|jVqdS�rrN�rD�	mailboxesr rrrr#+s
�z(AddressList.mailboxes.<locals>.<genexpr>�r.r&rrrrw)s
��zAddressList.mailboxescCstdd�|D�g�S)Ncss|]}|jdkr|jVqdSru�rD�
all_mailboxesr rrrr#0s
�z,AddressList.all_mailboxes.<locals>.<genexpr>rxr&rrrrz.s
��zAddressList.all_mailboxesN)r+rFrGrDrJrtrwrzrrrrrq!s

rqc@s4eZdZdZedd��Zedd��Zedd��ZdS)	�AddressrrcCs|djdkr|djSdS)Nr�group�rD�display_namer&rrrr~8szAddress.display_namecCs4|djdkr|dgS|djdkr*gS|djS�Nr�mailbox�invalid-mailboxrvr&rrrrw=s

zAddress.mailboxescCs:|djdkr|dgS|djdkr0|dgS|djSrryr&rrrrzEs


zAddress.all_mailboxesN)r+rFrGrDrJr~rwrzrrrrr{4s

r{c@s(eZdZdZedd��Zedd��ZdS)�MailboxList�mailbox-listcCsdd�|D�S)NcSsg|]}|jdkr|�qS)r�rsr rrrrQSs
z)MailboxList.mailboxes.<locals>.<listcomp>rr&rrrrwQszMailboxList.mailboxescCsdd�|D�S)NcSsg|]}|jdkr|�qS))r�r�rsr rrrrQWs
�z-MailboxList.all_mailboxes.<locals>.<listcomp>rr&rrrrzUszMailboxList.all_mailboxesN�r+rFrGrDrJrwrzrrrrr�Ms

r�c@s(eZdZdZedd��Zedd��ZdS)�	GroupList�
group-listcCs |r|djdkrgS|djS�Nrr�rvr&rrrrw_szGroupList.mailboxescCs |r|djdkrgS|djSr�ryr&rrrrzeszGroupList.all_mailboxesNr�rrrrr�[s

r�c@s4eZdZdZedd��Zedd��Zedd��ZdS)	�Groupr|cCs|djdkrgS|djS�N�r�rvr&rrrrwpszGroup.mailboxescCs|djdkrgS|djSr�ryr&rrrrzvszGroup.all_mailboxescCs
|djSr/)r~r&rrrr~|szGroup.display_nameN)r+rFrGrDrJrwrzr~rrrrr�ls

r�c@sLeZdZdZedd��Zedd��Zedd��Zedd	��Zed
d��Z	dS)
�NameAddr�	name-addrcCst|�dkrdS|djS�N�r)�lenr~r&rrrr~�szNameAddr.display_namecCs
|djS�N�����
local_partr&rrrr��szNameAddr.local_partcCs
|djSr���domainr&rrrr��szNameAddr.domaincCs
|djSr�)�router&rrrr��szNameAddr.routecCs
|djSr���	addr_specr&rrrr��szNameAddr.addr_specN�
r+rFrGrDrJr~r�r�r�r�rrrrr��s



r�c@s@eZdZdZedd��Zedd��Zedd��Zedd	��Zd
S)�	AngleAddrz
angle-addrcCs"|D]}|jdkr|jSqdS�N�	addr-spec)rDr�rgrrrr��s
zAngleAddr.local_partcCs"|D]}|jdkr|jSqdSr��rDr�rgrrrr��s
zAngleAddr.domaincCs"|D]}|jdkr|jSqdS)N�	obs-route)rD�domainsrgrrrr��s
zAngleAddr.routecCs<|D]2}|jdkr|jr"|jSt|j�|jSqdS)Nr�z<>)rDr�r�rrgrrrr��s

zAngleAddr.addr_specN)	r+rFrGrDrJr�r�r�r�rrrrr��s


r�c@seZdZdZedd��ZdS)�ObsRouter�cCsdd�|D�S)NcSsg|]}|jdkr|j�qSr�r�r rrrrQ�s
z$ObsRoute.domains.<locals>.<listcomp>rr&rrrr��szObsRoute.domainsN)r+rFrGrDrJr�rrrrr��sr�c@sLeZdZdZedd��Zedd��Zedd��Zedd	��Zed
d��Z	dS)
�Mailboxr�cCs|djdkr|djSdS�Nrr�r}r&rrrr~�szMailbox.display_namecCs
|djSr/r�r&rrrr��szMailbox.local_partcCs
|djSr/r�r&rrrr��szMailbox.domaincCs|djdkr|djSdSr�)rDr�r&rrrr��sz
Mailbox.routecCs
|djSr/r�r&rrrr��szMailbox.addr_specNr�rrrrr��s



r�c@s,eZdZdZedd��ZeZZZZ	dS)�InvalidMailboxr�cCsdSrrr&rrrr~�szInvalidMailbox.display_nameNr�rrrrr��s
r�cs(eZdZdZdZe�fdd��Z�ZS)�Domainr�Fcsd�t�j���S�Nr�r%rr�splitr&rrrr��sz
Domain.domain)r+rFrGrDr1rJr�rKrrrrr��sr�c@seZdZdZdS)�DotAtom�dot-atomNrTrrrrr��sr�c@seZdZdZdZdS)�DotAtomTextz
dot-atom-textTN�r+rFrGrDr1rrrrr��sr�c@seZdZdZdZdS)�
NoFoldLiteralzno-fold-literalFNr�rrrrr�sr�c@sDeZdZdZdZedd��Zedd��Zedd��Zed	d
��Z	dS)�AddrSpecr�FcCs
|djSr/r�r&rrrr�
szAddrSpec.local_partcCst|�dkrdS|djS)N�r�)r�r�r&rrrr�szAddrSpec.domaincCs<t|�dkr|djS|dj��|dj|dj��S)Nr�rr�r�)r�r�rstrip�lstripr&rrrrs
zAddrSpec.valuecCsLt|j�}t|�t|t�kr*t|j�}n|j}|jdk	rH|d|jS|S)N�@)�setr�r��
DOT_ATOM_ENDSrr�)rZnamesetZlprrrr�s

zAddrSpec.addr_specN)
r+rFrGrDr1rJr�r�rr�rrrrr�s


r�c@seZdZdZdZdS)�ObsLocalPartzobs-local-partFNr�rrrrr�&sr�cs4eZdZdZdZedd��Ze�fdd��Z�ZS)�DisplayNamezdisplay-nameFcCs�t|�}t|�dkr|jS|djdkr4|�d�n*|ddjdkr^t|ddd��|d<|djdkrv|��n*|ddjdkr�t|ddd��|d<|jS)NrrYr�r�)rr�rrD�pop)rrirrrr~1s
zDisplayName.display_namecs�d}|jrd}n|D]}|jdkrd}qt|�dkr�|r�d}}|djdks`|ddjdkrdd}|djdks�|ddjdkr�d}|t|j�|St�jSdS)	NFTrcrrrYrNr�)rrDr�rr~rr)rror"ZpreZpostrrrrBs
  zDisplayName.value)	r+rFrGrDrIrJr~rrKrrrrr�,s
r�c@s,eZdZdZdZedd��Zedd��ZdS)�	LocalPartz
local-partFcCs&|djdkr|djS|djSdS)Nrrc)rDrjrr&rrrr[s
zLocalPart.valuecCs�tg}t}d}|dtgD]�}|jdkr,q|r\|jdkr\|djdkr\t|dd��|d<t|t�}|r�|jdkr�|djdkr�|�t|dd���n
|�|�|d}|}qt|dd��}|jS)NFrrY�dotr�r�)�DOTrDr�
isinstancerhr)rriZlastZ
last_is_tl�tokZis_tlrrrr�bs(
�
�
zLocalPart.local_partN)r+rFrGrDr1rJrr�rrrrr�Vs
r�cs4eZdZdZdZe�fdd��Zedd��Z�ZS)�
DomainLiteralzdomain-literalFcsd�t�j���Sr�r�r&rrrr�szDomainLiteral.domaincCs"|D]}|jdkr|jSqdS)N�ptextrfrgrrr�ip�s
zDomainLiteral.ip)	r+rFrGrDr1rJr�r�rKrrrrr�zsr�c@seZdZdZdZdZdS)�MIMEVersionzmime-versionN)r+rFrGrD�major�minorrrrrr��sr�c@s4eZdZdZdZdZdZedd��Zedd��Z	dS)	�	Parameter�	parameterF�us-asciicCs|jr|djSdSr�)�	sectioned�numberr&rrr�section_number�szParameter.section_numbercCsf|D]\}|jdkr|jS|jdkr|D]4}|jdkr*|D] }|jdkr<|jSq<q*qdS)Nrrcrer)rDrlrkrrr�param_value�s




zParameter.param_valueN)
r+rFrGrDr��extendedr`rJr�r�rrrrr��s
r�c@seZdZdZdS)�InvalidParameter�invalid-parameterNrTrrrrr��sr�c@seZdZdZedd��ZdS)�	Attribute�	attributecCs$|D]}|j�d�r|jSqdS)N�attrtext)rD�endswithrrkrrrrl�szAttribute.stripped_valueN�r+rFrGrDrJrlrrrrr��sr�c@seZdZdZdZdS)�Section�sectionN)r+rFrGrDr�rrrrr��sr�c@seZdZdZedd��ZdS)�ValuercCs2|d}|jdkr|d}|j�d�r,|jS|jS)NrrYr�)rcr�zextended-attribute)rDr�rlrrkrrrrl�s
�zValue.stripped_valueNr�rrrrr��sr�c@s(eZdZdZdZedd��Zdd�ZdS)�MimeParameters�mime-parametersFc
cs�i}|D]T}|j�d�sq|djdkr*q|dj��}||krHg||<||�|j|f�q|��D�]~\}}t|td�d�}|dd}|j	}|j
s�t|�dkr�|dddkr�|ddj�t
�d��|dd�}g}d}|D]�\}	}
|	|k�r(|
j
�s|
j�t
�d��q�n|
j�t
�d��|d7}|
j}|
j
�r�ztj�|�}Wn&tk
�rttjj|d	d
�}YnRXz|�|d�}Wn"tk
�r�|�dd�}YnXt�|��r�|
j�t
���|�|�q�d
�|�}||fVqfdS)Nr�rr�)�keyr�z.duplicate parameter name; duplicate(s) ignoredz+duplicate parameter name; duplicate ignoredz(inconsistent RFC2231 parameter numberingzlatin-1)�encoding�surrogateescaper�r)rDr�r�striprhr��items�sortedrr`r�r�rr�InvalidHeaderDefectr��urllib�parseZunquote_to_bytes�UnicodeEncodeErrorZunquote�decode�LookupErrorr�_has_surrogates�UndecodableBytesDefectr%)r�paramsr6�name�partsZfirst_paramr`Zvalue_parts�ir��paramrrrrr��s`�

�
�
zMimeParameters.paramscCsTg}|jD].\}}|r.|�d�|t|���q
|�|�q
d�|�}|rPd|SdS)N�{}={}z; rNr)r�rhr*rr%)rr�r�rrrrr's
zMimeParameters.__str__N)r+rFrGrDrHrJr�r'rrrrr��s

Er�c@seZdZdZedd��ZdS)�ParameterizedHeaderValueFcCs&t|�D]}|jdkr|jSqiS)Nr�)�reversedrDr�rkrrrr�-s
zParameterizedHeaderValue.paramsN)r+rFrGrHrJr�rrrrr�'sr�c@seZdZdZdZdZdZdS)�ContentTypezcontent-typeF�textZplainN)r+rFrGrDr1�maintype�subtyperrrrr�5sr�c@seZdZdZdZdZdS)�ContentDispositionzcontent-dispositionFN)r+rFrGrDr1�content_dispositionrrrrr�<sr�c@seZdZdZdZdZdS)�ContentTransferEncodingzcontent-transfer-encodingFZ7bitN)r+rFrGrDr1r_rrrrr�Bsr�c@seZdZdZdZdS)�HeaderLabelzheader-labelFNr�rrrrr�Hsr�c@seZdZdZdZdd�ZdS)�MsgIDzmsg-idFcCst|�|jSr)r
�linesepr:rrrr;Qsz
MsgID.foldN)r+rFrGrDr1r;rrrrr�Msr�c@seZdZdZdS)�	MessageIDz
message-idNrTrrrrr�Vsr�c@seZdZdZdS)�InvalidMessageIDzinvalid-message-idNrTrrrrr�Zsr�c@seZdZdZdS)�Header�headerNrTrrrrr�^sr�csreZdZdZdZdZ�fdd�Z�fdd�Zdd�Ze	dd	��Z
d�fdd�	Zd
d�Ze	dd��Z
dd�Z�ZS)�TerminalTcst��||�}||_g|_|Sr)r�__new__rDr)�clsrrDrrrrr�lszTerminal.__new__csd�|jjt����Sr(r)r&rrrr,rszTerminal.__repr__cCst|jjd|j�dS)N�/)r>rr+rDr&rrrrAuszTerminal.pprintcCs
t|j�Sr)�listrr&rrrr-xszTerminal.all_defectsrc	s2d�||jj|jt���|js"dn
d�|j��gS)Nz
{}{}/{}({}){}rz {})r*rr+rDrr,rr@rrrrC|s�zTerminal._ppcCsdSrrr&rrr�pop_trailing_ws�szTerminal.pop_trailing_wscCsgSrrr&rrrr5�szTerminal.commentscCst|�|jfSr)r
rDr&rrr�__getnewargs__�szTerminal.__getnewargs__)r)r+rFrGr1rIrHr�r,rArJr-rCr�r5rrKrrrrr�fs
	
r�c@s eZdZedd��Zdd�ZdS)�WhiteSpaceTerminalcCsdSrMrr&rrrr�szWhiteSpaceTerminal.valuecCsdS)NTrr&rrrr0�sz!WhiteSpaceTerminal.startswith_fwsN�r+rFrGrJrr0rrrrr�s
rc@s eZdZedd��Zdd�ZdS)�
ValueTerminalcCs|Srrr&rrrr�szValueTerminal.valuecCsdS)NFrr&rrrr0�szValueTerminal.startswith_fwsNrrrrrr�s
rc@s eZdZedd��Zdd�ZdS)�EWWhiteSpaceTerminalcCsdSr�rr&rrrr�szEWWhiteSpaceTerminal.valuecCsdSr�rr&rrrr'�szEWWhiteSpaceTerminal.__str__N)r+rFrGrJrr'rrrrr�s
rc@seZdZdS)�_InvalidEwErrorN)r+rFrGrrrrr�srr��,�list-separatorr�zroute-component-markerz([{}]+)rz[^{}]+z[\x00-\x20\x7F]cCs>t|�}|r|j�t�|��t�|�r:|j�t�d��dS)Nz*Non-ASCII characters found in header token)�_non_printable_finderrrhrZNonPrintableDefectrr�r�)�xtextZnon_printablesrrr�_validate_xtext�s

�r
cCs�t|d�^}}g}d}d}tt|��D]L}||dkrJ|rDd}d}nd}q&|rTd}n|||krdq||�||�q&|d}d�|�d�||d�g|�|fS)Nr�FrTr)�
_wsp_splitter�ranger�rhr%)r�endcharsZfragment�	remainderZvchars�escape�had_qp�posrrr�_get_ptext_to_endchars�s$	rcCs.|��}t|dt|�t|��d�}||fS)N�fws)r�rr�)rZnewvaluerrrr�get_fwssrc
	Cs�t�}|�d�s t�d�|���|dd��dd�^}}||dd�krXt�d�|���d�|�}t|�dkr�|dtkr�|dtkr�|�	d�dkr�|�dd�^}}|d|}t|���dkr�|j
�t�d	��||_
d�|�}zt�d|d�\}}}}	Wn*ttfk
�r*td
�|j
���YnX||_||_|j
�|	�|�r�|dtk�rrt|�\}
}|�|
��qDt|d�^}}t|d�}t|�|�|�d�|�}�qD|�r�|dtk�r�|j
�t�d��||fS)
N�=?z"expected encoded word but found {}r�z?=r�rr�?zwhitespace inside encoded wordz!encoded word format invalid: '{}'�vtextz.missing trailing whitespace after encoded-word)r]�
startswithr�HeaderParseErrorr*r�r%r�r�countrrhr�r_�_ewr��
ValueError�KeyErrorrr`rar4�WSPrrrr
)
rZewr�rZremstr�restr�r`rarr6�charsrrrr�get_encoded_wordsd
��

�
��
�

�




�r!cCsFt�}|�rB|dtkr0t|�\}}|�|�qd}|�d�r�zt|�\}}Wn,tk
rfd}Yn�tjk
rzYnrXd}t	|�dkr�|dj
dkr�|j�t�d��d}|r�t	|�dkr�|d	j
d
kr�t
|dd�|d<|�|�qt|d�^}}|�rt�|��r|�d�^}}t|d�}t|�|�|�d�|�}q|S)
NrTrFr�rz&missing whitespace before encoded wordr����r^rr)rRrrrhrr!rrrr�rDrr�rr�rfc2047_matcher�search�	partitionrr
r%)rrSr6�valid_ewZhave_wsr�rrrrr�get_unstructured?sJ


��


r'cCs*t|d�\}}}t|d�}t|�||fS)Nz()r�)rrr
�rr��_rrr�get_qp_ctext�s
r*cCs*t|d�\}}}t|d�}t|�||fS)Nr
r�)rrr
r(rrr�get_qcontent�s

r+cCsNt|�}|st�d�|���|��}|t|�d�}t|d�}t|�||fS)Nzexpected atext but found '{}'�atext)�_non_atom_end_matcherrrr*r|r�rr
)r�mr,rrr�	get_atext�s�
r/cCsr|ddkrt�d�|���t�}|dd�}|rT|ddkrTt|�\}}|�|�|�rB|ddk�rB|dtkr�t|�\}}n�|dd�dk�r*d}z&t|�\}}|j	�t�
d��d	}Wn"tjk
r�t|�\}}YnX|�r6t|�dk�r6|d
jdk�r6|djd
k�r6t
|d
d�|d
<nt|�\}}|�|�qT|�sb|j	�t�
d��||fS||dd�fS)Nrr
zexpected '"' but found '{}'r�r�rFz!encoded word inside quoted stringTr�rr"r^z"end of header inside quoted string)rrr*rmr+rhrrr!rr�r�rDr)rZbare_quoted_stringr6r&rrr�get_bare_quoted_string�sL�

���

�r0cCs�|r |ddkr t�d�|���t�}|dd�}|r�|ddkr�|dtkr\t|�\}}n&|ddkrvt|�\}}nt|�\}}|�|�q2|s�|j	�t�
d��||fS||dd�fS)Nrrzexpected '(' but found '{}'r�rpzend of header inside comment)rrr*rnrr�get_commentr*rhrr�)rrOr6rrrr1�s&�
�r1cCsPt�}|rH|dtkrH|dtkr0t|�\}}nt|�\}}|�|�q||fSr/)rX�CFWS_LEADERrrr1rh)rrYr6rrr�get_cfws�sr3cCspt�}|r,|dtkr,t|�\}}|�|�t|�\}}|�|�|rh|dtkrht|�\}}|�|�||fSr/)rbr2r3rhr0)rZ
quoted_stringr6rrr�get_quoted_strings


r4cCs�t�}|r,|dtkr,t|�\}}|�|�|rL|dtkrLt�d�|���|�d�r�zt	|�\}}Wq�tjk
r�t
|�\}}Yq�Xnt
|�\}}|�|�|r�|dtkr�t|�\}}|�|�||fS)Nrzexpected atom but found '{}'r)rZr2r3rh�	ATOM_ENDSrrr*rr!r/)rr[r6rrr�get_atoms&
�


r6cCs�t�}|r|dtkr&t�d�|���|rt|dtkrtt|�\}}|�|�|r&|ddkr&|�t�|dd�}q&|dtkr�t�d�d|���||fS)Nrz8expected atom at a start of dot-atom-text but found '{}'rr�r�z4expected atom at end of dot-atom-text but found '{}')r�r5rrr*r/rhr�)rZ
dot_atom_textr6rrr�get_dot_atom_text0s �

�r7cCs�t�}|dtkr(t|�\}}|�|�|�d�rhzt|�\}}Wqttjk
rdt|�\}}YqtXnt|�\}}|�|�|r�|dtkr�t|�\}}|�|�||fS)Nrr)	r�r2r3rhrr!rrr7)rZdot_atomr6rrr�get_dot_atomCs



r8cCs�|dtkrt|�\}}nd}|s,t�d��|ddkrFt|�\}}n*|dtkrdt�d�|���nt|�\}}|dk	r�|g|dd�<||fS)Nrz5Expected 'atom' or 'quoted-string' but found nothing.r
z1Expected 'atom' or 'quoted-string' but found '{}')r2r3rrr4�SPECIALSr*r6)r�leaderr6rrr�get_word\s"��r;cCs�t�}zt|�\}}|�|�Wn(tjk
rH|j�t�d��YnX|r�|dtkr�|ddkr�|�t�|j�t�	d��|dd�}qJzt|�\}}WnDtjk
r�|dt
kr�t|�\}}|j�t�	d��n�YnX|�|�qJ||fS)Nzphrase does not start with wordrrzperiod in 'phrase'r�zcomment found without atom)rUr;rhrrrr��PHRASE_ENDSr��ObsoleteHeaderDefectr2r3)rrVr6rrr�
get_phrase~s4
�

�
�r>cCsvt�}d}|dtkr"t|�\}}|s6t�d�|���zt|�\}}Wn^tjk
r�zt|�\}}Wn6tjk
r�|ddkr�|dtkr��t	�}YnXYnX|dk	r�|g|dd�<|�
|�|�r4|ddks�|dtk�r4tt|�|�\}}|j
dk�r|j�
t�d��n|j�
t�d��||d<z|j�d�Wn(tk
�rl|j�
t�d��YnX||fS)	Nrz"expected local-part but found '{}'r�invalid-obs-local-partz<local-part is not dot-atom, quoted-string, or obs-local-partz,local-part is not a dot-atom (contains CFWS)�asciiz)local-part contains non-ASCII characters))r�r2r3rrr*r8r;r<rrh�get_obs_local_partr
rDrr�r=r�encoder�ZNonASCIILocalPartDefect)rr�r:r6�obs_local_partrrr�get_local_part�sJ�
 
�
�
�rDcCs�t�}d}|�r(|ddks*|dtk�r(|ddkrj|rL|j�t�d��|�t�d}|dd�}q
nD|ddkr�|�t|dd��|dd�}|j�t�d	��d}q
|r�|d
jdkr�|j�t�d��zt	|�\}}d}Wn4tj
k
�r|dtk�r
�t|�\}}YnX|�|�q
|djdk�sX|djd
k�rj|djdk�rj|j�t�d��|d
jdk�s�|d
jd
k�r�|djdk�r�|j�t�d��|j�r�d|_||fS)NFrrrzinvalid repeated '.'Tr��misplaced-specialz/'\' character outside of quoted-string/ccontentr�r�zmissing '.' between wordsrYz!Invalid leading '.' in local partr"z"Invalid trailing '.' in local partr?)
r�r<rrhrr�r�rrDr;rr2r3)rrCZlast_non_ws_was_dotr6rrrrA�sj 
�
�
�
���
���
�rAcCs@t|d�\}}}t|d�}|r0|j�t�d��t|�||fS)Nz[]r�z(quoted printable found in domain-literal)rrrrhrr=r
)rr�rrrr�	get_dtext�s

�rFcCs,|rdS|�t�d��|�tdd��dS)NFz"end of input inside domain-literal�]�domain-literal-endT)rhrr�r)r�domain_literalrrr�_check_for_early_dl_ends�rJcCsjt�}|dtkr(t|�\}}|�|�|s6t�d��|ddkrRt�d�|���|dd�}t||�rp||fS|�tdd��|dt	kr�t
|�\}}|�|�t|�\}}|�|�t||�r�||fS|dt	kr�t
|�\}}|�|�t||�r�||fS|ddk�rt�d�|���|�tdd	��|dd�}|�rb|dtk�rbt|�\}}|�|�||fS)
Nrzexpected domain-literal�[z6expected '[' at start of domain-literal but found '{}'r�zdomain-literal-startrGz4expected ']' at end of domain-literal but found '{}'rH)r�r2r3rhrrr*rJrrrrF)rrIr6rrr�get_domain_literalsH

�





�
rLcCsrt�}d}|dtkr"t|�\}}|s6t�d�|���|ddkrvt|�\}}|dk	rd|g|dd�<|�|�||fSzt|�\}}Wn"tjk
r�t	|�\}}YnX|r�|ddkr�t�d��|dk	r�|g|dd�<|�|�|�rj|ddk�rj|j
�t�d��|djdk�r*|d|dd�<|�rj|ddk�rj|�t
�t	|d	d��\}}|�|��q*||fS)
Nrzexpected domain but found '{}'rKr�zInvalid Domainrz(domain is not a dot-atom (contains CFWS)r�r�)r�r2r3rrr*rLrhr8r6rr=rDr�)rr�r:r6rrr�
get_domain=sD�



�
rMcCs|t�}t|�\}}|�|�|r,|ddkrF|j�t�d��||fS|�tdd��t|dd��\}}|�|�||fS)Nrr�z#addr-spec local part with no domain�address-at-symbolr�)r�rDrhrrr�rrM)rr�r6rrr�
get_addr_speccs

�
rOcCs�t�}|rj|ddks"|dtkrj|dtkrFt|�\}}|�|�q|ddkr|�t�|dd�}q|rz|ddkr�t�d�|���|�t�t	|dd��\}}|�|�|�r>|ddk�r>|�t�|dd�}|s�q>|dtk�rt|�\}}|�|�|ddkr�|�t�t	|dd��\}}|�|�q�|�sNt�d��|ddk�rlt�d�|���|�t
dd	��||dd�fS)
Nrrr�r�z(expected obs-route domain but found '{}'z%end of header while parsing obs-route�:z4expected ':' marking end of obs-route but found '{}'zend-of-obs-route-marker)r�r2r3rh�
ListSeparatorrrr*�RouteComponentMarkerrMr)rZ	obs_router6rrr�
get_obs_routessF
�





�rScCs�t�}|dtkr(t|�\}}|�|�|r8|ddkrHt�d�|���|�tdd��|dd�}|ddkr�|�tdd��|j�t�	d��|dd�}||fSzt
|�\}}Wnztjk
�r0z"t|�\}}|j�t�d	��Wn(tjk
�rt�d
�|���YnX|�|�t
|�\}}YnX|�|�|�r^|ddk�r^|dd�}n|j�t�	d��|�tdd��|�r�|dtk�r�t|�\}}|�|�||fS)Nr�<z"expected angle-addr but found '{}'zangle-addr-startr��>zangle-addr-endznull addr-spec in angle-addrz*obsolete route specification in angle-addrz.expected addr-spec or obs-route but found '{}'z"missing trailing '>' on angle-addr)
r�r2r3rhrrr*rrr�rOrSr=)rZ
angle_addrr6rrr�get_angle_addr�sT
�
�
�
�



�
rVcCs<t�}t|�\}}|�|dd��|jdd�|_||fSr)r�r>r4r)rr~r6rrr�get_display_name�s
rWcCs�t�}d}|dtkr6t|�\}}|s6t�d�|���|ddkr�|dtkr^t�d�|���t|�\}}|s~t�d�|���|dk	r�|g|ddd�<d}|�|�t	|�\}}|dk	r�|g|dd�<|�|�||fS)Nrz!expected name-addr but found '{}'rT)
r�r2r3rrr*r<rWrhrV)rZ	name_addrr:r6rrr�
get_name_addr�s6���

rXcCs�t�}zt|�\}}WnNtjk
rdzt|�\}}Wn&tjk
r^t�d�|���YnXYnXtdd�|jD��r�d|_|�	|�||fS)Nzexpected mailbox but found '{}'css|]}t|tj�VqdSr)r�rr�r rrrr#s�zget_mailbox.<locals>.<genexpr>r�)
r�rXrrrOr*�anyr-rDrh)rr�r6rrr�get_mailbox�s ��
rZcCsdt�}|r\|d|kr\|dtkrD|�t|dd��|dd�}qt|�\}}|�|�q||fS)NrrEr�)r�r<rhrr>)rr
Zinvalid_mailboxr6rrr�get_invalid_mailboxs�r[cCs�t�}|�r�|ddk�r�zt|�\}}|�|�W�ntjk
�r<d}|dtkr�t|�\}}|rv|ddkr�|�|�|j�t�d��n@t	|d�\}}|dk	r�|g|dd�<|�|�|j�t�
d��nb|ddkr�|j�t�d��nBt	|d�\}}|dk	�r|g|dd�<|�|�|j�t�
d��YnX|�r�|ddk�r�|d}d|_t	|d�\}}|�|�|j�t�
d��|r|ddkr|�t
�|d	d�}q||fS)
Nr�;z,;zempty element in mailbox-listzinvalid mailbox in mailbox-listrr�r�r�)r�rZrhrrr2r3rr=r[r�rDr4rQ)rZmailbox_listr6r:r�rrr�get_mailbox_listsX

�

�
�


�

�
r]cCst�}|s$|j�t�d��||fSd}|r�|dtkr�t|�\}}|sl|j�t�d��|�|�||fS|ddkr�|�|�||fSt|�\}}t|j	�dkr�|dk	r�|�|�|�
|�|j�t�d��||fS|dk	r�|g|dd�<|�|�||fS)Nzend of header before group-listrzend of header in group-listr\zgroup-list with empty entries)r�rrhrr�r2r3r]r�rzr4r=)rZ
group_listr:r6rrr�get_group_listWs>
�
�




�
r^cCs t�}t|�\}}|r"|ddkr2t�d�|���|�|�|�tdd��|dd�}|r�|ddkr�|�tdd��||dd�fSt|�\}}|�|�|s�|j�t�	d��n|ddkr�t�d	�|���|�tdd��|dd�}|�r|dt
k�rt|�\}}|�|�||fS)
NrrPz8expected ':' at end of group display name but found '{}'zgroup-display-name-terminatorr�r\zgroup-terminatorzend of header in groupz)expected ';' at end of group but found {})r�rWrrr*rhrr^rr�r2r3)rr|r6rrr�	get_group|s8�


��
r_cCsxt�}zt|�\}}WnNtjk
rdzt|�\}}Wn&tjk
r^t�d�|���YnXYnX|�|�||fS)Nzexpected address but found '{}')r{r_rrrZr*rh)rrrr6rrr�get_address�s�
r`c
Cs�t�}|�r�zt|�\}}|�|�W�n tjk
�rH}z�d}|dtkr�t|�\}}|rj|ddkr�|�|�|j�t�d��nFt	|d�\}}|dk	r�|g|dd�<|�t
|g��|j�t�d��nh|ddkr�|j�t�d��nHt	|d�\}}|dk	�r|g|dd�<|�t
|g��|j�t�d��W5d}~XYnX|�r�|ddk�r�|dd}d|_t	|d�\}}|�
|�|j�t�d��|r|�tdd��|d	d�}q||fS)
Nrrz"address-list entry with no contentzinvalid address in address-listzempty element in address-listr�r�rr�)rqr`rhrrr2r3rr=r[r{r�rDr4r)rZaddress_listr6�errr:r�rrr�get_address_list�sX


�
�
�

�

�rbcCs�t�}|st�d�|���|ddkr6t�d�|���|�tdd��|dd�}t|�\}}|�|�|rx|ddkr�t�d�|���|�tdd	��||dd�fS)
Nz'expected no-fold-literal but found '{}'rrKz;expected '[' at the start of no-fold-literal but found '{}'zno-fold-literal-startr�rGz9expected ']' at the end of no-fold-literal but found '{}'zno-fold-literal-end)r�rrr*rhrrF)rZno_fold_literalr6rrr�get_no_fold_literal�s.���
��rccCs�t�}|r,|dtkr,t|�\}}|�|�|r<|ddkrLt�d�|���|�tdd��|dd�}zt|�\}}Wn`tjk
r�z"t	|�\}}|j
�t�d��Wn&tjk
r�t�d�|���YnXYnX|�|�|r�|ddk�r@|j
�t�d	��|�r8|dd
k�r8|�td
d��|dd�}||fS|�tdd��|dd�}zt|�\}}Wn�tjk
�rzt
|�\}}Wnrtjk
�r}zPz"t|�\}}|j
�t�d
��Wn(tjk
�r�t�d�|���YnXW5d}~XYnXYnX|�|�|�r6|dd
k�r6|dd�}n|j
�t�d��|�td
d��|�r�|dtk�r�t|�\}}|�|�||fS)NrrTzexpected msg-id but found '{}'zmsg-id-startr�zobsolete id-left in msg-idz4expected dot-atom-text or obs-id-left but found '{}'r�zmsg-id with no id-rightrUz
msg-id-endrNzobsolete id-right in msg-idzFexpected dot-atom-text, no-fold-literal or obs-id-right but found '{}'zmissing trailing '>' on msg-id)r�r2r3rhrrr*rr7rArr=r�rcrM)rZmsg_idr6�errr�
get_msg_ids~
�
�
��

�
�
��"

�
rec
Cs�t�}zt|�\}}|�|�WnLtjk
rl}z,t|�}t|�}|j�t�d�	|���W5d}~XYnX|r�|j�t�d�	|���|S)NzInvalid msg-id: {!r}zUnexpected {!r})
r�rerhrrr'r�rr�r*)rZ
message_idr6Zexrrr�parse_message_idIs�
�rfcCs�t�}|s |j�t�d��|S|dtkrXt|�\}}|�|�|sX|j�t�d��d}|r�|ddkr�|dtkr�||d7}|dd�}q\|��s�|j�t�d�	|���|�t
|d��nt|�|_|�t
|d	��|�r|dtk�rt|�\}}|�|�|�r|ddk�rT|jdk	�r:|j�t�d
��|�rP|�t
|d��|S|�t
dd��|dd�}|�r�|dtk�r�t|�\}}|�|�|�s�|jdk	�r�|j�t�d
��|Sd}|�r�|dtk�r�||d7}|dd�}�q�|���s*|j�t�d�	|���|�t
|d��nt|�|_
|�t
|d	��|�rn|dtk�rnt|�\}}|�|�|�r�|j�t�d
��|�t
|d��|S)Nz%Missing MIME version number (eg: 1.0)rz0Expected MIME version number but found only CFWSrrr�z1Expected MIME major version number but found {!r}r	�digitsz0Incomplete MIME version; found only major numberzversion-separatorz1Expected MIME minor version number but found {!r}z'Excess non-CFWS text after MIME version)r�rrhr�HeaderMissingRequiredValuer2r3�isdigitr�r*r�intr�r�)rZmime_versionr6rgrrr�parse_mime_versiones�
�

�
�


�

�

�


�rkcCsdt�}|r\|ddkr\|dtkrD|�t|dd��|dd�}qt|�\}}|�|�q||fS)Nrr\rEr�)r�r<rhrr>)rZinvalid_parameterr6rrr�get_invalid_parameter�s�rlcCsNt|�}|st�d�|���|��}|t|�d�}t|d�}t|�||fS)Nzexpected ttext but found '{}'�ttext)�_non_token_end_matcherrrr*r|r�rr
)rr.rmrrr�	get_ttext�s	�
rocCs�t�}|r,|dtkr,t|�\}}|�|�|rL|dtkrLt�d�|���t|�\}}|�|�|r�|dtkr�t|�\}}|�|�||fS�Nrzexpected token but found '{}')	r\r2r3rh�
TOKEN_ENDSrrr*ro)rZmtokenr6rrr�	get_token�s	
�

rrcCsNt|�}|st�d�|���|��}|t|�d�}t|d�}t|�||fS)Nz expected attrtext but found {!r}r�)�_non_attribute_end_matcherrrr*r|r�rr
�rr.r�rrr�get_attrtext�s	�
rucCs�t�}|r,|dtkr,t|�\}}|�|�|rL|dtkrLt�d�|���t|�\}}|�|�|r�|dtkr�t|�\}}|�|�||fSrp)	r�r2r3rh�ATTRIBUTE_ENDSrrr*ru�rr�r6rrr�
get_attribute�s	
�

rxcCsNt|�}|st�d�|���|��}|t|�d�}t|d�}t|�||fS)Nz)expected extended attrtext but found {!r}�extended-attrtext)�#_non_extended_attribute_end_matcherrrr*r|r�rr
rtrrr�get_extended_attrtext	s�
r{cCs�t�}|r,|dtkr,t|�\}}|�|�|rL|dtkrLt�d�|���t|�\}}|�|�|r�|dtkr�t|�\}}|�|�||fSrp)	r�r2r3rh�EXTENDED_ATTRIBUTE_ENDSrrr*r{rwrrr�get_extended_attribute!	s
�

r}cCs�t�}|r|ddkr&t�d�|���|�tdd��|dd�}|rR|d��sbt�d�|���d}|r�|d��r�||d7}|dd�}qf|ddkr�|dkr�|j�t�d	��t	|�|_
|�t|d
��||fS)Nr�*zExpected section but found {}zsection-markerr�z$Expected section number but found {}r�0z'section number has an invalid leading 0rg)r�rrr*rhrrirZInvalidHeaderErrorrjr�)rr�rgrrr�get_section7	s,	��
�
r�cCs�t�}|st�d��d}|dtkr0t|�\}}|sDt�d�|���|ddkr^t|�\}}nt|�\}}|dk	r�|g|dd�<|�|�||fS)Nz&Expected value but found end of stringrz Expected value but found only {}r
)	r�rrr2r3r*r4r}rh)r�vr:r6rrr�	get_valueU	s"
�
r�cCs�t�}t|�\}}|�|�|r,|ddkrL|j�t�d�|���||fS|ddkr�z t|�\}}d|_|�|�Wntj	k
r�YnX|s�t�	d��|ddkr�|�t
dd��|dd�}d|_|dd	kr�t�	d
��|�t
d	d��|dd�}d}|�r,|dtk�r,t
|�\}}|�|�d}|}|j�rF|�rF|ddk�rFt|�\}}|j}d
}|jdk�r�|�r�|ddk�r�d}n$t|�\}}	|	�r�|	ddk�r�d}n(zt|�\}}	WnYnX|	�s�d}|�r0|j�t�d��|�|�|D](}
|
jdk�rg|
dd�<|
}�q*�q|}nd}|j�t�d��|�r`|ddk�r`d}nt|�\}}|j�r�|jdk�r�|�r�|ddk�r�|�|�|dk	�r�|}||fS|j�t�d��|�s�|j�t�d��|�|�|dk�r�||fSn�|dk	�r@|D]}
|
jdk�r
�q$�q
|
jdk|�|
�|
j|_|ddk�r^t�	d�|���|�t
dd��|dd�}|�r�|ddk�r�t|�\}}|�|�|j|_|�r�|ddk�r�t�	d�|���|�t
dd��|dd�}|dk	�rdt�}|�r^|dtk�rt|�\}}n2|ddk�rDt
dd�}|dd�}nt|�\}}|�|��q�|}nt|�\}}|�|�|dk	�r�|}||fS)Nrr\z)Parameter contains name ({}) but no valuer~TzIncomplete parameterzextended-parameter-markerr��=zParameter not followed by '='�parameter-separatorr
F�'z5Quoted string value for extended parameter is invalidrezZParameter marked as extended but appears to have a quoted string value that is non-encodedzcApparent initial-extended-value but attribute was not marked as extended or was not initial sectionz(Missing required charset/lang delimitersryr�z=Expected RFC2231 char/lang encoding delimiter, but found {!r}zRFC2231-delimiterz;Expected RFC2231 char/lang encoding delimiter, but found {}ZDQUOTE)r�rxrhrrr�r*r�r�rrr�r2r3r4rlr�rur{rDr�rr`rar�rrr+)rr�r6r:rZappendtoZqstringZinner_valueZ
semi_validr�tr�rrr�
get_parameterk	s�
�



�


�


�
�






�
�



r�c
Csjt�}|�rfzt|�\}}|�|�Wn�tjk
r�}z�d}|dtkrVt|�\}}|sp|�|�|WY�xS|ddkr�|dk	r�|�|�|j�t�d��n@t	|�\}}|r�|g|dd�<|�|�|j�t�d�
|���W5d}~XYnX|�rD|ddk�rD|d}d|_t	|�\}}|�|�|j�t�d�
|���|r|�t
dd��|d	d�}q|S)
Nrr\zparameter entry with no contentzinvalid parameter {!r}r�r�z)parameter with invalid trailing text {!r}r�r�)r�r�rhrrr2r3rr�rlr*rDr4r)rZmime_parametersr6rar:r�rrr�parse_mime_parameters�	sJ



�

�

�r�cCs�|rV|ddkrV|dtkr>|�t|dd��|dd�}qt|�\}}|�|�q|s^dS|�tdd��|�t|dd���dS)Nrr\rEr�r�)r<rhrr>r�)Z	tokenlistrr6rrr�_find_mime_parameters-
sr�c
Cs�t�}d}|s$|j�t�d��|Szt|�\}}Wn<tjk
rp|j�t�d�|���t	||�|YSX|�|�|r�|ddkr�|j�t�d��|r�t	||�|S|j
����|_
|�tdd��|dd�}zt|�\}}Wn>tjk
�r*|j�t�d	�|���t	||�|YSX|�|�|j
����|_|�sP|S|dd
k�r�|j�t�d�|���|`
|`t	||�|S|�td
d��|�t|dd���|S)
NFz"Missing content type specificationz(Expected content maintype but found {!r}rr�zInvalid content typezcontent-type-separatorr�z'Expected content subtype but found {!r}r\z<Only parameters are valid after content type, but found {!r}r�)r�rrhrrhrrrr�r*r�rr��lowerr�rr�r�)rZctypeZrecoverr6rrr�parse_content_type_header=
sd
�
�



�

�



��
r�c
Cs�t�}|s |j�t�d��|Szt|�\}}Wn<tjk
rl|j�t�d�|���t	||�|YSX|�|�|j
����|_
|s�|S|ddkr�|j�t�d�|���t	||�|S|�tdd��|�t|dd���|S)NzMissing content dispositionz+Expected content disposition but found {!r}rr\zCOnly parameters are valid after content disposition, but found {!r}r�r�)r�rrhrrhrrrr�r*r�rr�r�r�rr�)rZdisp_headerr6rrr� parse_content_disposition_headerv
s:
�
�



��
r�c
Cs�t�}|s |j�t�d��|Szt|�\}}Wn.tjk
r^|j�t�d�|���YnX|�|�|j	�
���|_|s�|S|r�|j�t�d��|dt
kr�|�t|dd��|dd�}q�t|�\}}|�|�q�|S)Nz!Missing content transfer encodingz1Expected content transfer encoding but found {!r}z*Extra text after content transfer encodingrrEr�)r�rrhrrhrrrr�r*rr�r�r_r<rr>)rZ
cte_headerr6rrr�&parse_content_transfer_encoding_header�
s4
�
�

�r�cCsDd}|r@|dr@|ddtkr@|dd}|ddd�|d<|S)Nrr�)r)�linesZwsprrr�_steal_trailing_WSP_if_exists�
s
r�cCs�|jp
tj}|jrdnd}dg}d}d}d}tdd�}t|�}	|	�r�|	�d�}
|
|kr`|d8}q>t|
�}|
jdkr�t	|�t
@r�d	}z|�|�|}Wn6tk
r�t
d
d�|
jD��r�d}nd}d	}YnX|
jd
kr�t|
|||�q>|�r�|�s�|
j�spd}d}|
j�rp|
j|d�dt|j��}
|j|
k�rpt|
�|t|d�k�r^t|�}|�|�|d|
7<q>t|
d��s�t|
�|	}	nt|||||
j|�}d}q>t|�|t|d�k�r�|d|7<q>|
j�rt|�d|k�rt|�}|�s|
���r|�||�d}q>t|
d��sNt|
�}|
j�sD|d7}|�|�||	}	q>|
j�rn|�sn|	�d|
�d	}q>t|�}|�s�|
���r�|�||�q>|d|7<q>|j�|�|jS)N�utf-8r�rrF�wrap_as_ew_blockedr�r�Tcss|]}t|tj�VqdSr)r�rr�r rrrr#�
s�z%_refold_parse_tree.<locals>.<genexpr>�unknown-8bitr�r7r�rB)Zmax_line_length�sys�maxsize�utf8r�r�r�r
rDr�r9rBr�rYr-�_fold_mime_parametersr1rHr;r�r�r�rhrE�_fold_as_ewrIr0�insertr%)Z
parse_treer8�maxlenr�r��last_ewr�Z
want_encodingZend_ew_not_allowedr�r2�tstrr`Zencoded_part�newlineZnewpartsrrrr9�
s�


�



��
r9cCs�|dk	r<|r<tt|d|d�|��}|dd|�|d<|dtkr�|d}|dd�}t|d�|krz|�t|��|d|7<d}|dtkr�|d}|dd�}|dkr�t|d�n|}|dkr�dn|}	t|	�d}
|
d|kr�t�d��|�r�|t|d�}||
}|dk�r,|�d	�q�|d|�}
tj	|
|	d
�}t|�|}|dk�r�|
dd�}
tj	|
|	d
�}t|�|}�qR|d|7<|t|
�d�}|r�|�d	�t|d�}q�|d|7<|�r�|SdS)Nr�rr�rr�r��z3max_line_length is too small to fit an encoded wordrN)r`)
r
r'rr�rhr�rrrrB)Z	to_encoder�r�r�rIr`Zleading_wspZtrailing_wspZnew_last_ewZ	encode_as�
chrome_lenZremaining_spaceZ
text_spaceZto_encode_wordZencoded_wordZexcessrrrr�1sT��



r�c	Cs�|jD�]�\}}|d���d�s2|dd7<|}d}z|�|�d}Wn0tk
r|d}t�|�rtd}d}nd}YnX|r�tjj	|d	|d
�}	d�
|||	�}
nd�
|t|��}
t|d�t|
�d
|kr�|dd|
|d<qn"t|
�d|k�r
|�
d|
�qd}|d}|rt|�tt|��dt|�}
||
dk�rLd}||
d}}|d|�}tjj	|d	|d
�}	t|	�|k�r��q�|d
8}�q\|�
d�
||||	��d	}|d
7}||d�}|�r|dd7<�qqdS)Nr�r\�strictFTr�r�r�r)Zsaferz
{}*={}''{}r�r�rNr�rz''r��Nz {}*{}*={}{})r�r�r�rBr�rr�r�r�ror*rr�rhr
)r2r�r�r�r�rr`Z
error_handlerZencoding_requiredZ
encoded_valuer�r�Zextra_chromer�Z
splitpointZmaxchars�partialrrrr�rsn


� ��r�)��rer�r��stringr�operatorrZemailrrrrr�rr2r9r5r�r<Z	TSPECIALSrqZ	ASPECIALSrvr|r�compile�VERBOSE�	MULTILINEr#r�rrLrRrUrWrXrZr\r]rbrmrnrqr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
r�rrrrrr�rQrRr*r%r�rr�matchr-�findallrrnrsrzr
rrr!r'r*r+r/r0r1r3r4r6r7r8r;r>rDrArFrJrLrMrOrSrVrWrXrZr[r]r^r_r`rbrcrerfrkrlrorrrurxr{r}r�r�r�r�r�r�r�r�r�r9r�r�rrrr�<module>Fs,
�C"	
!*$
V	+





����
1C+
"&'/'&).9%7ED49/gA

Filemanager

Name Type Size Permission Actions
__init__.cpython-38.opt-1.pyc File 1.67 KB 0644
__init__.cpython-38.opt-2.pyc File 1.06 KB 0644
__init__.cpython-38.pyc File 1.67 KB 0644
_encoded_words.cpython-38.opt-1.pyc File 5.57 KB 0644
_encoded_words.cpython-38.opt-2.pyc File 3.73 KB 0644
_encoded_words.cpython-38.pyc File 5.57 KB 0644
_header_value_parser.cpython-38.opt-1.pyc File 78.03 KB 0644
_header_value_parser.cpython-38.opt-2.pyc File 61.55 KB 0644
_header_value_parser.cpython-38.pyc File 78.07 KB 0644
_parseaddr.cpython-38.opt-1.pyc File 12.19 KB 0644
_parseaddr.cpython-38.opt-2.pyc File 9.3 KB 0644
_parseaddr.cpython-38.pyc File 12.19 KB 0644
_policybase.cpython-38.opt-1.pyc File 14.48 KB 0644
_policybase.cpython-38.opt-2.pyc File 5.86 KB 0644
_policybase.cpython-38.pyc File 14.48 KB 0644
base64mime.cpython-38.opt-1.pyc File 3.17 KB 0644
base64mime.cpython-38.opt-2.pyc File 1.44 KB 0644
base64mime.cpython-38.pyc File 3.17 KB 0644
charset.cpython-38.opt-1.pyc File 11.17 KB 0644
charset.cpython-38.opt-2.pyc File 4.99 KB 0644
charset.cpython-38.pyc File 11.21 KB 0644
contentmanager.cpython-38.opt-1.pyc File 7.2 KB 0644
contentmanager.cpython-38.opt-2.pyc File 7.2 KB 0644
contentmanager.cpython-38.pyc File 7.2 KB 0644
encoders.cpython-38.opt-1.pyc File 1.59 KB 0644
encoders.cpython-38.opt-2.pyc File 1.25 KB 0644
encoders.cpython-38.pyc File 1.59 KB 0644
errors.cpython-38.opt-1.pyc File 5.78 KB 0644
errors.cpython-38.opt-2.pyc File 4.38 KB 0644
errors.cpython-38.pyc File 5.78 KB 0644
feedparser.cpython-38.opt-1.pyc File 10.26 KB 0644
feedparser.cpython-38.opt-2.pyc File 8.63 KB 0644
feedparser.cpython-38.pyc File 10.41 KB 0644
generator.cpython-38.opt-1.pyc File 12.25 KB 0644
generator.cpython-38.opt-2.pyc File 8.63 KB 0644
generator.cpython-38.pyc File 12.25 KB 0644
header.cpython-38.opt-1.pyc File 16.07 KB 0644
header.cpython-38.opt-2.pyc File 10.58 KB 0644
header.cpython-38.pyc File 16.07 KB 0644
headerregistry.cpython-38.opt-1.pyc File 21.49 KB 0644
headerregistry.cpython-38.opt-2.pyc File 15.86 KB 0644
headerregistry.cpython-38.pyc File 21.54 KB 0644
iterators.cpython-38.opt-1.pyc File 1.89 KB 0644
iterators.cpython-38.opt-2.pyc File 1.28 KB 0644
iterators.cpython-38.pyc File 1.89 KB 0644
message.cpython-38.opt-1.pyc File 37 KB 0644
message.cpython-38.opt-2.pyc File 20.83 KB 0644
message.cpython-38.pyc File 37 KB 0644
parser.cpython-38.opt-1.pyc File 5.6 KB 0644
parser.cpython-38.opt-2.pyc File 2.66 KB 0644
parser.cpython-38.pyc File 5.6 KB 0644
policy.cpython-38.opt-1.pyc File 9.45 KB 0644
policy.cpython-38.opt-2.pyc File 3.38 KB 0644
policy.cpython-38.pyc File 9.45 KB 0644
quoprimime.cpython-38.opt-1.pyc File 7.51 KB 0644
quoprimime.cpython-38.opt-2.pyc File 4.12 KB 0644
quoprimime.cpython-38.pyc File 7.51 KB 0644
utils.cpython-38.opt-1.pyc File 9.33 KB 0644
utils.cpython-38.opt-2.pyc File 6.09 KB 0644
utils.cpython-38.pyc File 9.33 KB 0644