+
     BiG             	       :   ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt	 ^ RIH
t
 ^ RIHt ]! R4      t]]! R4      ,          t]! R	4      t]],          t]]! R
4      ,
          t]]! R4      ,
          t]]! R4      ,          ]! R
4      ,
          t]],          t]]! R4      ,          t]],          t]]! R4      ,
          tRR0t]],          tR tR t] P8                  ! R] P:                  ] P<                  ,          4      t ! R R] 4      t! ! R R]!4      t" ! R R]!4      t# ! R R]!4      t$ ! R R]!4      t% ! R R]"4      t& ! R  R!]!4      t' ! R" R#]!4      t( ! R$ R%]!4      t) ! R& R']!4      t* ! R( R)]*4      t+ ! R* R+]"4      t, ! R, R-]!4      t- ! R. R/]!4      t. ! R0 R1]!4      t/ ! R2 R3]!4      t0 ! R4 R5]!4      t1 ! R6 R7]!4      t2 ! R8 R9]!4      t3 ! R: R;]!4      t4 ! R< R=]!4      t5 ! R> R?]!4      t6 ! R@ RA]!4      t7 ! RB RC]!4      t8 ! RD RE]!4      t9 ! RF RG]!4      t: ! RH RI]!4      t; ! RJ RK]!4      t< ! RL RM]$4      t= ! RN RO]!4      t> ! RP RQ]!4      t? ! RR RS]!4      t@ ! RT RU]!4      tA ! RV RW]A4      tB ! RX RY]!4      tC ! RZ R[]!4      tD ! R\ R]]!4      tE ! R^ R_]!4      tF ! R` Ra]!4      tG ! Rb Rc]G4      tH ! Rd Re]G4      tI ! Rf Rg]!4      tJ ! Rh Ri]!4      tK ! Rj Rk]!4      tL ! Rl Rm]L4      tM ! Rn Ro]M4      tN ! Rp Rq]!4      tO ! Rr Rs]P4      tQ ! Rt Ru]Q4      tR ! Rv Rw]Q4      tS ! Rx Ry]R4      tT ! Rz R{]
P                  4      tV]S! R
R|4      tW]S! R}R~4      tXR]XnY        R]XnZ        ]S! RR4      t[] P8                  ! RP                  RP                  ]4      4      4      P                  t_] P8                  ! RP                  ] P                  ! RP                  ]4      4      4      4      P                  tb] P8                  ! R4      P                  td] P8                  ! RP                  ] P                  ! RP                  ]4      4      4      4      P                  te] P8                  ! RP                  ] P                  ! RP                  ]4      4      4      4      P                  tf] P8                  ! RP                  ] P                  ! RP                  ]4      4      4      4      P                  tgR thR tiR tjRR ltkR tlR tmR tnR toR tpR tqR trR tsR ttR tuR tvR twR txR tyR tzR t{R t|R t}R t~R tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR# )    N)	hexdigits)
itemgetter)_encoded_words)errors)utilsz 	(z()<>@,:;.\"[].z."(z/?=z*'%%
c                 X    \        V 4      P                  R R4      P                  RR4      # )\\\"z\")strreplacevalues   &1/usr/lib/python3.14/email/_header_value_parser.pymake_quoted_pairsr   c   s&    u:dF+33C??    c                 $    \        V 4      pR V R 2# )r   )r   )r   escapeds   & r   quote_stringr   h   s    &Gwiq>r   z
   =\?            # literal =?
   [^?]*          # charset
   \?             # literal ?
   [qQbB]         # literal 'q' or 'b', case insensitive
   \?             # literal ?
  .*?             # encoded word
  \?=             # literal ?=
c                      a a ] tR t^}t oRtRtRtV 3R ltR tV 3R lt	]
R 4       t]
R 4       tR t]
R	 4       t]
R
 4       tR tRR ltRR ltRR ltRtVtV ;t# )	TokenListNTc                6   < \         SV `  ! V/ VB  . V n        R # N)super__init__defects)selfargskw	__class__s   &*,r   r    TokenList.__init__   s    $%"%r   c                2    R P                  R V  4       4      # ) c              3   8   "   T F  p\        V4      x  K  	  R # 5ir   r   .0xs   & r   	<genexpr>$TokenList.__str__.<locals>.<genexpr>        ,t!s1vvt   joinr"   s   &r   __str__TokenList.__str__   s    ww,t,,,r   c                h   < R P                  V P                  P                  \        SV `  4       4      # z{}({})formatr%   __name__r   __repr__r"   r%   s   &r   r<   TokenList.__repr__   s+    t~~66"W-/1 	1r   c                2    R P                  R V  4       4      # )r(   c              3   `   "   T F$  qP                   '       g   K  VP                   x  K&  	  R # 5ir   r   r+   s   & r   r.   "TokenList.value.<locals>.<genexpr>   s     81wqwws   ..r2   r4   s   &r   r   TokenList.value   s    ww8888r   c                <    \        R  V  4       V P                  4      # )c              3   8   "   T F  qP                   x  K  	  R # 5ir   )all_defectsr+   s   & r   r.   (TokenList.all_defects.<locals>.<genexpr>   s     04aMM4r1   )sumr!   r4   s   &r   rE   TokenList.all_defects   s    040$,,??r   c                0    V ^ ,          P                  4       # r   )startswith_fwsr4   s   &r   rK   TokenList.startswith_fws   s    Aw%%''r   c                j    \         ;QJ d    R  V  4       F  '       d   K   R# 	  R# ! R  V  4       4      # )c              3   8   "   T F  qP                   x  K  	  R # 5ir   )as_ew_allowed)r,   parts   & r   r.   *TokenList.as_ew_allowed.<locals>.<genexpr>   s     7$$%%$r1   FT)allr4   s   &r   rO   TokenList.as_ew_allowed   s-     s7$7ss7s7s7$777r   c                R    . pV  F  pVP                  VP                  4       K   	  V# r   )extendcomments)r"   rV   tokens   &  r   rV   TokenList.comments   s&    EOOENN+ r   c                   \        WR 7      # )policy)_refold_parse_treer"   r[   s   &$r   foldTokenList.fold   s    !$66r   c                <    \        V P                  VR 7      4       R# )indentN)printppstrr"   rb   s   &&r   pprintTokenList.pprint   s    djjj'(r   c                D    R P                  V P                  VR7      4      # )r   ra   )r3   _ppre   s   &&r   rd   TokenList.ppstr   s    yy011r   c              #    "   R P                  VV P                  P                  V P                  4      x  V  FQ  p\	        VR4      '       g   VRP                  V4      ,           x  K1  VP                  VR,           4       Rj  xL
  KS  	  V P                  '       d   RP                  V P                  4      pMRpRP                  W4      x  R#  LM5i)z{}{}/{}(ri   z*    !! invalid element in token list: {!r}z    Nz Defects: {}r(   z{}){})r:   r%   r;   
token_typehasattrri   r!   )r"   rb   rW   extras   &&  r   ri   TokenList._pp   s     NN##OO 	 E5%(( !55;VE]C D !99VF]333  <<<"))$,,7EEnnV++ 4s   BCCC4C)r!   r(   )r;   
__module____qualname____firstlineno__rl   syntactic_breakew_combine_allowedr    r5   r<   propertyr   rE   rK   rO   rV   r^   rf   rd   ri   __static_attributes____classdictcell____classcell__r%   __classdict__s   @@r   r   r   }   s     JO-1 9 9 @ @( 8 8  7)2, ,r   r   c                   @   a  ] tR t^t o ]R 4       t]R 4       tRtV tR# )WhiteSpaceTokenListc                    R #   r4   s   &r   r   WhiteSpaceTokenList.value       r   c                h    V  Uu. uF!  qP                   R 8X  g   K  VP                  NK#  	  up# u upi )comment)rl   contentr"   r-   s   & r   rV   WhiteSpaceTokenList.comments   s)    #'C4a<<+B			4CCC   //r   N)	r;   rq   rr   rs   rv   r   rV   rw   rx   r{   s   @r   r}   r}      s-       D Dr   r}   c                       ] tR t^tRtRtR# )UnstructuredTokenListunstructuredr   Nr;   rq   rr   rs   rl   rw   r   r   r   r   r      s    Jr   r   c                       ] tR t^tRtRtR# )Phrasephraser   Nr   r   r   r   r   r          Jr   r   c                       ] tR t^tRtRtR# )Wordwordr   Nr   r   r   r   r   r          Jr   r   c                       ] tR t^tRtRtR# )CFWSListcfwsr   Nr   r   r   r   r   r      r   r   r   c                       ] tR t^tRtRtR# )Atomatomr   Nr   r   r   r   r   r      r   r   r   c                       ] tR t^tRtRtRtR# )TokenrW   Fr   N)r;   rq   rr   rs   rl   encode_as_ewrw   r   r   r   r   r      s    JLr   r   c                   &    ] tR t^tRtRtRtRtRtR# )EncodedWordencoded-wordNr   )	r;   rq   rr   rs   rl   ctecharsetlangrw   r   r   r   r   r      s    J
CGDr   r   c                   T   a  ] tR t^t o Rt]R 4       t]R 4       t]R 4       tRt	V t
R# )QuotedStringquoted-stringc                V    V  F"  pVP                   R 8X  g   K  VP                  u # 	  R# bare-quoted-stringNrl   r   r   s   & r   r   QuotedString.content   s"    A||33ww r   c                    . pV  FK  pVP                   R 8X  d   VP                  \        V4      4       K0  VP                  VP                  4       KM  	  RP	                  V4      # )r   r(   )rl   appendr   r   r3   )r"   resr-   s   &  r   quoted_valueQuotedString.quoted_value   sN    A||33

3q6"

177#	 
 wws|r   c                V    V  F"  pVP                   R 8X  g   K  VP                  u # 	  R# r   r   r"   rW   s   & r   stripped_valueQuotedString.stripped_value   s%    E#77{{" r   r   N)r;   rq   rr   rs   rl   rv   r   r   r   rw   rx   r   s   @r   r   r      sD      J 
   # #r   r   c                   :   a  ] tR tRt o RtR t]R 4       tRtV t	R# )BareQuotedStringi  r   c                D    \        R P                  R V  4       4      4      # )r(   c              3   8   "   T F  p\        V4      x  K  	  R # 5ir   r*   r+   s   & r   r.   +BareQuotedString.__str__.<locals>.<genexpr>
  s     #9DqCFFDr1   )r   r3   r4   s   &r   r5   BareQuotedString.__str__	  s    BGG#9D#99::r   c                2    R P                  R V  4       4      # )r(   c              3   8   "   T F  p\        V4      x  K  	  R # 5ir   r*   r+   s   & r   r.   )BareQuotedString.value.<locals>.<genexpr>  r0   r1   r2   r4   s   &r   r   BareQuotedString.value      ww,t,,,r   r   N)
r;   rq   rr   rs   rl   r5   rv   r   rw   rx   r   s   @r   r   r     s#     %J; - -r   r   c                   P   a  ] tR tRt o RtR tR t]R 4       t]R 4       t	Rt
V tR# )	Commenti  r   c                    R P                  \        R.V  Uu. uF  qP                  V4      NK  	  upR... 4      4      # u upi )r(   r   ))r3   rG   quoter   s   & r   r5   Comment.__str__  sI    wws E489DqZZ]D9 E  "	# $ 	$9s   ?c                    VP                   R 8X  d   \        V4      # \        V4      P                  RR4      P                  RR4      P                  RR4      # )r   r   r   r   z\(r   z\))rl   r   r   )r"   r   s   &&r   r   Comment.quote  sR    y(u:5z!!$/77"%u..5g"%u/.	.r   c                2    R P                  R V  4       4      # )r(   c              3   8   "   T F  p\        V4      x  K  	  R # 5ir   r*   r+   s   & r   r.   "Comment.content.<locals>.<genexpr>%  r0   r1   r2   r4   s   &r   r   Comment.content#  r   r   c                    V P                   .# r   )r   r4   s   &r   rV   Comment.comments'  s    ~r   r   N)r;   rq   rr   rs   rl   r5   r   rv   r   rV   rw   rx   r   s   @r   r   r     s<     J$. - -  r   r   c                   T   a  ] tR tRt o Rt]R 4       t]R 4       t]R 4       tRt	V t
R# )AddressListi+  zaddress-listc                T    V  Uu. uF  qP                   R 8X  g   K  VNK  	  up# u upi )addressrl   r   s   & r   	addressesAddressList.addresses/  %    ;4a<<#:4;;;   %%c                (    \        R  V  4       . 4      # )c              3   ^   "   T F#  qP                   R 8X  g   K  VP                  x  K%  	  R# 5ir   Nrl   	mailboxesr+   s   & r   r.   (AddressList.mailboxes.<locals>.<genexpr>5  s&      >!\\9%<  AKK!   --rG   r4   s   &r   r   AddressList.mailboxes3  !     >!>?AC 	Cr   c                (    \        R  V  4       . 4      # )c              3   ^   "   T F#  qP                   R 8X  g   K  VP                  x  K%  	  R# 5ir   rl   all_mailboxesr+   s   & r   r.   ,AddressList.all_mailboxes.<locals>.<genexpr>:  s&      >!\\9%< $AOO!r   r   r4   s   &r   r   AddressList.all_mailboxes8  r   r   r   N)r;   rq   rr   rs   rl   rv   r   r   r   rw   rx   r   s   @r   r   r   +  sH     J< < C C C Cr   r   c                   T   a  ] tR tRt o Rt]R 4       t]R 4       t]R 4       tRt	V t
R# )Addressi>  r   c                \    V ^ ,          P                   R8X  d   V ^ ,          P                  # R# )r   groupNrl   display_namer4   s   &r   r   Address.display_nameB  s)    7(7''' )r   c                    V ^ ,          P                   R8X  d   V ^ ,          .# V ^ ,          P                   R8X  d   . # V ^ ,          P                  # r   mailboxinvalid-mailboxr   r4   s   &r   r   Address.mailboxesG  sH    7*G9!W#44IAw   r   c                    V ^ ,          P                   R8X  d   V ^ ,          .# V ^ ,          P                   R8X  d   V ^ ,          .# V ^ ,          P                  # r   r   r4   s   &r   r   Address.all_mailboxesO  sO    7*G9!W#44G9Aw$$$r   r   N)r;   rq   rr   rs   rl   rv   r   r   r   rw   rx   r   s   @r   r   r   >  sD     J( ( ! ! % %r   r   c                   D   a  ] tR tRt o Rt]R 4       t]R 4       tRtV t	R# )MailboxListiW  mailbox-listc                T    V  Uu. uF  qP                   R 8X  g   K  VNK  	  up# u upi )r   r   r   s   & r   r   MailboxList.mailboxes[  r   r   c                V    V  Uu. uF  pVP                   R9   g   K  VNK  	  up# u upi )r   )r   r   r   r   s   & r   r   MailboxList.all_mailboxes_  s4     ?4a||== 4 ? 	? ?s   &&r   N
r;   rq   rr   rs   rl   rv   r   r   rw   rx   r   s   @r   r   r   W  s0     J< < ? ?r   r   c                   D   a  ] tR tRt o Rt]R 4       t]R 4       tRtV t	R# )	GroupListie  
group-listc                l    V '       d   V ^ ,          P                   R8w  d   . # V ^ ,          P                  # r   r   r   r4   s   &r   r   GroupList.mailboxesi  s+    tAw))^;IAw   r   c                l    V '       d   V ^ ,          P                   R8w  d   . # V ^ ,          P                  # r  r   r4   s   &r   r   GroupList.all_mailboxeso  s+    tAw))^;IAw$$$r   r   Nr   r   s   @r   r   r   e  s0     J! !
 % %r   r   c                   T   a  ] tR tRt o Rt]R 4       t]R 4       t]R 4       tRt	V t
R# )Groupiv  r   c                \    V ^,          P                   R8w  d   . # V ^,          P                  #    r  r   r4   s   &r   r   Group.mailboxesz  s)    7-IAw   r   c                \    V ^,          P                   R8w  d   . # V ^,          P                  # r
  r   r4   s   &r   r   Group.all_mailboxes  s)    7-IAw$$$r   c                (    V ^ ,          P                   # rJ   )r   r4   s   &r   r   Group.display_name  s    Aw###r   r   N)r;   rq   rr   rs   rl   rv   r   r   r   rw   rx   r   s   @r   r  r  v  sD     J! !
 % %
 $ $r   r  c                   t   a  ] tR tRt o Rt]R 4       t]R 4       t]R 4       t]R 4       t	]R 4       t
RtV tR	# )
NameAddri  	name-addrc                L    \        V 4      ^8X  d   R# V ^ ,          P                  # )   N)lenr   r4   s   &r   r   NameAddr.display_name  s     t9>Aw###r   c                (    V R,          P                   # r  
local_partr4   s   &r   r  NameAddr.local_part  s    Bx"""r   c                (    V R,          P                   # r  domainr4   s   &r   r   NameAddr.domain  s    Bxr   c                (    V R,          P                   # r  )router4   s   &r   r#  NameAddr.route  s    Bx~~r   c                (    V R,          P                   # r  	addr_specr4   s   &r   r'  NameAddr.addr_spec  s    Bx!!!r   r   Nr;   rq   rr   rs   rl   rv   r   r  r   r#  r'  rw   rx   r   s   @r   r  r    sl     J$ $
 # #     " "r   r  c                   d   a  ] tR tRt o Rt]R 4       t]R 4       t]R 4       t]R 4       t	Rt
V tR# )		AngleAddri  z
angle-addrc                V    V  F"  pVP                   R 8X  g   K  VP                  u # 	  R# 	addr-specN)rl   r  r   s   & r   r  AngleAddr.local_part  s"    A||{*||# r   c                V    V  F"  pVP                   R 8X  g   K  VP                  u # 	  R# r-  rl   r   r   s   & r   r   AngleAddr.domain  s!    A||{*xx r   c                V    V  F"  pVP                   R 8X  g   K  VP                  u # 	  R# )	obs-routeN)rl   domainsr   s   & r   r#  AngleAddr.route  s"    A||{*yy  r   c                    V  F\  pVP                   R 8X  g   K  VP                  '       d   VP                  u # \        VP                  4      VP                  ,           u # 	  R# )r.  z<>)rl   r  r'  r   r   s   & r   r'  AngleAddr.addr_spec  sH    A||{*<<<;;&'5CC  r   r   N)r;   rq   rr   rs   rl   rv   r  r   r#  r'  rw   rx   r   s   @r   r+  r+    sX     J$ $
    
 ! !
  r   r+  c                   4   a  ] tR tRt o Rt]R 4       tRtV tR# )ObsRoutei  r4  c                h    V  Uu. uF!  qP                   R 8X  g   K  VP                  NK#  	  up# u upi r  r1  r   s   & r   r5  ObsRoute.domains  s)    "&C$Q,,(*B$CCCr   r   N)	r;   rq   rr   rs   rl   rv   r5  rw   rx   r   s   @r   r:  r:    s     JD Dr   r:  c                   t   a  ] tR tRt o Rt]R 4       t]R 4       t]R 4       t]R 4       t	]R 4       t
RtV tR	# )
Mailboxi  r   c                \    V ^ ,          P                   R8X  d   V ^ ,          P                  # R# r   r  Nr   r4   s   &r   r   Mailbox.display_name  s)    7,7''' -r   c                (    V ^ ,          P                   # rJ   r  r4   s   &r   r  Mailbox.local_part      Aw!!!r   c                (    V ^ ,          P                   # rJ   r  r4   s   &r   r   Mailbox.domain  s    Aw~~r   c                \    V ^ ,          P                   R8X  d   V ^ ,          P                  # R# r@  )rl   r#  r4   s   &r   r#  Mailbox.route  s'    7,7==  -r   c                (    V ^ ,          P                   # rJ   r&  r4   s   &r   r'  Mailbox.addr_spec  s    Aw   r   r   Nr)  r   s   @r   r>  r>    sl     J( ( " "   ! ! ! !r   r>  c                   D   a  ] tR tRt o Rt]R 4       t];t;t;t	t
RtV tR# )InvalidMailboxi  r   c                    R # r   r   r4   s   &r   r   InvalidMailbox.display_name      r   r   Nr)  r   s   @r   rL  rL    s2     "J  /;:J::%)r   rL  c                   D   a a ] tR tRt oRtRt]V 3R l4       tRtVt	V ;t
# )Domaini  r   Fc                R   < R P                  \        SV `  P                  4       4      # rp   r3   r   r   splitr=   s   &r   r   Domain.domain      wwuw}**,--r   r   )r;   rq   rr   rs   rl   rO   rv   r   rw   rx   ry   rz   s   @@r   rQ  rQ    s&     JM. . .r   rQ  c                       ] tR tRtRtRtR# )DotAtomi  dot-atomr   Nr   r   r   r   rX  rX    s    Jr   rX  c                       ] tR tRtRtRtRtR# )DotAtomTexti  zdot-atom-textTr   Nr;   rq   rr   rs   rl   rO   rw   r   r   r   r[  r[    s     JMr   r[  c                       ] tR tRtRtRtRtR# )NoFoldLiterali
  zno-fold-literalFr   Nr\  r   r   r   r^  r^  
  s    "JMr   r^  c                   h   a  ] tR tRt o RtRt]R 4       t]R 4       t]R 4       t	]R 4       t
RtV tR	# )
AddrSpeci  r.  Fc                (    V ^ ,          P                   # rJ   r  r4   s   &r   r  AddrSpec.local_part  rD  r   c                L    \        V 4      ^8  d   R# V R,          P                  # )   Nr  )r  r   r4   s   &r   r   AddrSpec.domain  s    t9q=Bxr   c                   \        V 4      ^8  d   V ^ ,          P                  # V ^ ,          P                  P                  4       V ^,          P                  ,           V ^,          P                  P                  4       ,           # )rd  )r  r   rstriplstripr4   s   &r   r   AddrSpec.value  sU    t9q=7== Aw}}##%d1gmm3DGMM4H4H4JJJr   c                   \        V P                  4      p\        V4      \        V\        ,
          4      8  d   \	        V P                  4      pMV P                  pV P
                  e   VR,           V P
                  ,           # V# )N@)setr  r  DOT_ATOM_ENDSr   r   )r"   namesetlps   &  r   r'  AddrSpec.addr_spec$  s_    doo&w<#gm344doo.BB;;"8dkk))	r   r   N)r;   rq   rr   rs   rl   rO   rv   r  r   r   r'  rw   rx   r   s   @r   r`  r`    s_     JM" "  
 K K
  r   r`  c                       ] tR tRtRtRtRtR# )ObsLocalParti0  zobs-local-partFr   Nr\  r   r   r   rr  rr  0  s    !JMr   rr  c                   T   a a ] tR tRt oRtRt]R 4       t]V 3R l4       tRt	Vt
V ;t# )DisplayNamei6  zdisplay-nameFc                |   \        V 4      p\        V4      ^ 8X  d   VP                  # V^ ,          P                  R8X  d   VP	                  ^ 4       MX\        V^ ,          \         4      '       d<   V^ ,          ^ ,          P                  R8X  d   \        V^ ,          R,          4      V^ &   VR,          P                  R8X  d   VP	                  4        VP                  # \        VR,          \         4      '       d8   VR,          R,          P                  R8X  d   \        VR,          RR 4      VR&   VP                  # )r   r   r  NNNr  )r   r  r   rl   pop
isinstance)r"   r   s   & r   r   DisplayName.display_name;  s    os8q=99q6&GGAJ3q69--F1I((F2"3q6":.Ar7'GGI
 yy 3r7I..GBK**f4#CGCRL1Byyr   c                V  < R pV P                   '       d   RpMV  F  pVP                  R8X  g   K  RpK  	  \        V 4      ^ 8w  d   V'       d   R;r4V ^ ,          P                  R8X  g=   \        V ^ ,          \        4      '       d"   V ^ ,          ^ ,          P                  R8X  d   RpV R,          P                  R8X  g=   \        V R,          \        4      '       d"   V R,          R,          P                  R8X  d   RpV\        V P                  4      ,           V,           # \        SV `   # )FTr   r(   r   r   r  )	r!   rl   r  rx  r   r   r   r   r   )r"   r   r-   prepostr%   s   &    r   r   DisplayName.valueN  s    <<<E<<?2 E  t9>eOCQ""f,47I..Q
%%/R##v-48Y//R''61|D$5$566t;;7= r   r   )r;   rq   rr   rs   rl   ru   rv   r   r   rw   rx   ry   rz   s   @@r   rt  rt  6  s;     J $ ! ! !r   rt  c                   H   a  ] tR tRt o RtRt]R 4       t]R 4       tRt	V t
R# )	LocalPartif  z
local-partFc                ~    V ^ ,          P                   R8X  d   V ^ ,          P                  # V ^ ,          P                  # )r   r   )rl   r   r   r4   s   &r   r   LocalPart.valuek  s2    707'''7== r   c                4   \         .p\         pR pV ^ ,          \         .,            F  pVP                  R8X  d   K  V'       d;   VP                  R8X  d*   VR,          P                  R8X  d   \        VRR 4      VR&   \        V\        4      pV'       dL   VP                  R8X  d;   V^ ,          P                  R8X  d#   VP	                  \        VR,          4      4       MVP	                  V4       VR,          pTpK  	  \        V^R 4      pVP
                  # )Fr   dotNrv  r  )DOTrl   r   rx  r   r   )r"   r   last
last_is_tltokis_tls   &     r   r  LocalPart.local_partr  s     e
7cU??C~~'s~~6H''61#D"I.BsI.E$//U2F%%/

9SW-.

3r7DJ # Ab	"yyr   r   N)r;   rq   rr   rs   rl   rO   rv   r   r  rw   rx   r   s   @r   r  r  f  s5     JM! !  r   r  c                   T   a a ] tR tRt oRtRt]V 3R l4       t]R 4       tRt	Vt
V ;t# )DomainLiterali  zdomain-literalFc                R   < R P                  \        SV `  P                  4       4      # rp   rS  r=   s   &r   r   DomainLiteral.domain  rV  r   c                V    V  F"  pVP                   R 8X  g   K  VP                  u # 	  R# )ptextNr   r   s   & r   ipDomainLiteral.ip  s!    A||w&ww r   r   )r;   rq   rr   rs   rl   rO   rv   r   r  rw   rx   ry   rz   s   @@r   r  r    s:     !JM. .   r   r  c                   "    ] tR tRtRtRtRtRtR# )MIMEVersioni  zmime-versionNr   )r;   rq   rr   rs   rl   majorminorrw   r   r   r   r  r    s    JEEr   r  c                   P   a  ] tR tRt o RtRtRtRt]R 4       t	]R 4       t
RtV tR# )		Parameteri  	parameterFus-asciic                P    V P                   '       d   V ^,          P                  # ^ # )r  )	sectionednumberr4   s   &r   section_numberParameter.section_number  s     "&tAw~~6Q6r   c                   V  F}  pVP                   R 8X  d   VP                  u # VP                   R8X  g   K5  V FB  pVP                   R8X  g   K  V F&  pVP                   R 8X  g   K  VP                  u u u # 	  KD  	  K  	  R# )r   r   r   r(   )rl   r   r   s   & r   param_valueParameter.param_value  sx     E7*+++?2"E''+??%*E$//7:',';'; ; &+ #	  r   r   N)r;   rq   rr   rs   rl   r  extendedr   rv   r  r  rw   rx   r   s   @r   r  r    s?     JIHG7 7
  r   r  c                       ] tR tRtRtRtR# )InvalidParameteri  invalid-parameterr   Nr   r   r   r   r  r    s    $Jr   r  c                   4   a  ] tR tRt o Rt]R 4       tRtV tR# )	Attributei  	attributec                v    V  F2  pVP                   P                  R 4      '       g   K&  VP                  u # 	  R# )attrtextN)rl   endswithr   r   s   & r   r   Attribute.stripped_value  s-    E((44{{" r   r   N	r;   rq   rr   rs   rl   rv   r   rw   rx   r   s   @r   r  r    s     J# #r   r  c                       ] tR tRtRtRtRtR# )Sectioni  sectionNr   )r;   rq   rr   rs   rl   r  rw   r   r   r   r  r    s    JFr   r  c                   4   a  ] tR tRt o Rt]R 4       tRtV tR# )Valuei  r   c                    V ^ ,          pVP                   R8X  d
   V ^,          pVP                   P                  R4      '       d   VP                  # V P                  # )r   r   )r   r  zextended-attribute)rl   r  r   r   r   s   & r   r   Value.stripped_value  sV    Qv%GE$$DF F'''zzr   r   Nr  r   s   @r   r  r    s     J r   r  c                   >   a  ] tR tRt o RtRt]R 4       tR tRt	V t
R# )MimeParametersi  mime-parametersFc              #  ,  "   / pV  F  pVP                   P                  R 4      '       g   K&  V^ ,          P                   R8w  d   K@  V^ ,          P                  P                  4       pW19  d   . W&   W,          P	                  VP
                  V34       K  	  VP                  4        EF	  w  r4\        V\        ^ 4      R7      pV^ ,          ^,          pVP                  pVP                  '       gl   \        V4      ^8  d\   V^,          ^ ,          ^ 8X  dG   V^,          ^,          P                  P	                  \        P                  ! R4      4       VR,          p. p^ pV EF3  w  rW8w  ds   V
P                  '       g2   V
P                  P	                  \        P                  ! R4      4       KO  V
P                  P	                  \        P                  ! R4      4       V^,          pV
P                  pV
P                  '       d~    \         P"                  P%                  V4      p VP'                  VR4      p\,        P.                  ! V4      '       d/   V
P                  P	                  \        P0                  ! 4       4       VP	                  V4       EK6  	  RP5                  V4      pW;3x  EK  	  R#   \(        \*        3 d    TP'                  RR4      p Li ; i  \*         d%    \         P"                  P3                  TR	R
7      p Li ; i5i)r  r  )keyz.duplicate parameter name; duplicate(s) ignored:Nr  Nz+duplicate parameter name; duplicate ignoredz(inconsistent RFC2231 parameter numberingsurrogateescaper  zlatin-1)encodingr(   N)rl   r  r   stripr   r  itemssortedr   r   r  r  r!   r   InvalidHeaderDefectr  urllibparseunquote_to_bytesdecodeLookupErrorUnicodeEncodeErrorr   _has_surrogatesUndecodableBytesDefectunquoter3   )r"   paramsrW   namepartsfirst_paramr   value_partsir  paramr   s   &           r   r  MimeParameters.params  s     E##,,[99Qx""k18>>'')D!!L!5!5u =>  "<<>KD5jm4E(1+K!))G '''CJN8A;!#!HQK''..v/I/IH0J K!"IE KA).%!& !>>>,,V-G-GI.K L ,,V-G-GF.H IQ))>>>R & = =e DP$)LL:K$LE !0077!MM001N1N1PQ""5)C */D GGK(E+g *R !,-?@ P
 %*LL=N$OEP . P !' 4 4UY 4 O	PsV   E?LBL
K"*J9<LA!L9#KLKL",LLLLc           	        . pV P                    FJ  w  r#V'       d-   VP                  R P                  V\        V4      4      4       K9  VP                  V4       KL  	  RP	                  V4      pV'       d
   RV,           # R# ){}={}z; r   r(   )r  r   r:   r   r3   )r"   r  r  r   s   &   r   r5   MimeParameters.__str__,  sc    ;;KDgnnT<3FGHd#	 '
 6"%sV|-2-r   r   N)r;   rq   rr   rs   rl   rt   rv   r  r5   rw   rx   r   s   @r   r  r    s.     "JOC CJ. .r   r  c                   4   a  ] tR tRt o Rt]R 4       tRtV tR# )ParameterizedHeaderValuei7  Fc                h    \        V 4       F"  pVP                  R 8X  g   K  VP                  u # 	  / # )r  )reversedrl   r  r   s   & r   r  ParameterizedHeaderValue.params=  s0    d^E#44||# $ 	r   r   N)	r;   rq   rr   rs   rt   rv   r  rw   rx   r   s   @r   r  r  7  s      O r   r  c                   &    ] tR tRtRtRtRtRtRtR# )ContentTypeiE  zcontent-typeFtextplainr   N)	r;   rq   rr   rs   rl   rO   maintypesubtyperw   r   r   r   r  r  E  s    JMHGr   r  c                   "    ] tR tRtRtRtRtRtR# )ContentDispositioniL  zcontent-dispositionFNr   )r;   rq   rr   rs   rl   rO   content_dispositionrw   r   r   r   r  r  L  s    &JMr   r  c                   "    ] tR tRtRtRtRtRtR# )ContentTransferEncodingiR  zcontent-transfer-encodingF7bitr   N)r;   rq   rr   rs   rl   rO   r   rw   r   r   r   r  r  R  s    ,JM
Cr   r  c                       ] tR tRtRtRtRtR# )HeaderLabeliX  zheader-labelFr   Nr\  r   r   r   r  r  X  s    JMr   r  c                   .   a  ] tR tRt o RtRtR tRtV tR# )MsgIDi]  zmsg-idFc                :    \        V 4      VP                  ,           # r   )r   linesepr]   s   &&r   r^   
MsgID.folda  s    4y6>>))r   r   N)	r;   rq   rr   rs   rl   rO   r^   rw   rx   r   s   @r   r  r  ]  s     JM* *r   r  c                       ] tR tRtRtRtR# )	MessageIDif  z
message-idr   Nr   r   r   r   r  r  f  s    Jr   r  c                       ] tR tRtRtRtR# )InvalidMessageIDij  zinvalid-message-idr   Nr   r   r   r   r  r  j  s    %Jr   r  c                       ] tR tRtRtRtR# )Headerin  headerr   Nr   r   r   r   r  r  n  r   r   r  c                      a a ] tR tRt oRtRtRtV 3R ltV 3R ltR t	]
R 4       tRV 3R lltR t]
R	 4       tR
 tRtVtV ;t# )Terminaliv  Tc                @   < \         SV `  W4      pW#n        . Vn        V# r   )r   __new__rl   r!   )clsr   rl   r"   r%   s   &&& r   r  Terminal.__new__|  s"    ws*$r   c                h   < R P                  V P                  P                  \        SV `  4       4      # r8   r9   r=   s   &r   r<   Terminal.__repr__  s&    t~~668H8JKKr   c                t    \        V P                  P                  R ,           V P                  ,           4       R# )/N)rc   r%   r;   rl   r4   s   &r   rf   Terminal.pprint  s"    dnn%%+doo=>r   c                ,    \        V P                  4      # r   )listr!   r4   s   &r   rE   Terminal.all_defects  s    DLL!!r   c           	        < R P                  TV P                  P                  V P                  \        SV `  4       V P                  '       g   R4      .# RP                  V P                  4      4      .# )z{}{}/{}({}){}r(   z {})r:   r%   r;   rl   r   r<   r!   )r"   rb   r%   s   &&r   ri   Terminal._pp  si    &&NN##OOGlllB  	
 ).T\\(B  	r   c                    R # r   r   r4   s   &r   pop_trailing_wsTerminal.pop_trailing_ws  rO  r   c                    . # r   r   r4   s   &r   rV   Terminal.comments  s    	r   c                0    \        V 4      V P                  3# r   )r   rl   r4   s   &r   __getnewargs__Terminal.__getnewargs__  s    4y$//**r   )r!   rl   rp   )r;   rq   rr   rs   rO   ru   rt   r  r<   rf   rv   rE   ri   r  rV   r	  rw   rx   ry   rz   s   @@r   r  r  v  sa     MOL? " "  + +r   r  c                   6   a  ] tR tRt o ]R 4       tR tRtV tR# )WhiteSpaceTerminali  c                    R # r   r   r4   s   &r   r   WhiteSpaceTerminal.value  r   r   c                    R # )Tr   r4   s   &r   rK   !WhiteSpaceTerminal.startswith_fws  s    r   r   N	r;   rq   rr   rs   rv   r   rK   rw   rx   r   s   @r   r  r    s!       r   r  c                   6   a  ] tR tRt o ]R 4       tR tRtV tR# )ValueTerminali  c                    V # r   r   r4   s   &r   r   ValueTerminal.value  s    r   c                    R # )Fr   r4   s   &r   rK   ValueTerminal.startswith_fws  s    r   r   Nr  r   s   @r   r  r    s!       r   r  c                   6   a  ] tR tRt o ]R 4       tR tRtV tR# )EWWhiteSpaceTerminali  c                    R # rp   r   r4   s   &r   r   EWWhiteSpaceTerminal.value  s    r   c                    R # rp   r   r4   s   &r   r5   EWWhiteSpaceTerminal.__str__  s    r   r   N)	r;   rq   rr   rs   rv   r   r5   rw   rx   r   s   @r   r  r    s!       r   r  c                       ] tR tRtRtR# )_InvalidEwErrori  r   N)r;   rq   rr   rs   rw   r   r   r   r  r    s    r   r  r  ,zlist-separatorFrk  zroute-component-markerz([{}]+)r(   z[^{}]+z[\x00-\x20\x7F]c                 $   \        V 4      pV'       d0   V P                  P                  \        P                  ! V4      4       \
        P                  ! V 4      '       d2   V P                  P                  \        P                  ! R 4      4       R# R# )z*Non-ASCII characters found in header tokenN)_non_printable_finderr!   r   r   NonPrintableDefectr   r  r  )xtextnon_printabless   & r   _validate_xtextr&    sf     +51NV66~FGU##V::8: 	; $r   c                 |   V '       g   R# \        V ^4      vr#. pRpRp\        \        V4      4       FR  pW',          R8X  d   V'       d   RpRpMRpK!  V'       d   RpMW',          V9   d    M$VP                  W',          4       KT  	  X^,           pR P	                  V4      R P	                  W'R .V,           4      V3# )r(   Fr   TN)r(   r(   F)_wsp_splitterranger  r   r3   )r   endcharsfragment	remaindervcharsescapehad_qpposs   &&      r   _get_ptext_to_endcharsr1    s     (2HFFFS]#=D F]h&hm$ $ Ag776?BGGXd^$4y$@A6IIr   c                 x    V P                  4       p\        V R \        V 4      \        V4      ,
           R4      pW!3# )Nfws)rh  r  r  )r   newvaluer3  s   &  r   get_fwsr5    s8     ||~H
U#<CJs8}$<=u
EC=r   c                    \        4       pV P                  R 4      '       g&   \        P                  ! RP	                  V 4      4      hV R,          P                  R^4      vr4W0R,          8X  d&   \        P                  ! RP	                  V 4      4      hRP                  V4      p\        V4      ^8  d^   V^ ,          \        9   dL   V^,          \        9   d:   VP                  R4      ^8  d$   VP                  R^4      vrdVR,           V,           p\        VP                  4       4      ^8  d0   VP                  P                  \        P                  ! R4      4       Wn        RP                  V4      p  \        P                  ! R V,           R,           4      w  rxrYn        Yn        TP                  P+                  T
4       T'       dz   T^ ,          \,        9   d!   \/        T4      w  rTP                  T4       K:  \1        T^4      vr\3        Y4      p\5        T4       TP                  T4       RP                  T4      pK  T '       dB   T ^ ,          \,        9  d0   TP                  P                  \        P                  ! R4      4       Y 3#   \         \"        3 d&    \%        RP	                  TP                  4      4      hi ; i)	=?z"expected encoded word but found {}:r  NNz?=r(   ?zwhitespace inside encoded wordz!encoded word format invalid: '{}'z.missing trailing whitespace after encoded-word)r   
startswithr   HeaderParseErrorr:   rT  r3   r  r   countr!   r   r  r   _ewr  
ValueErrorKeyErrorr  r   r   rU   WSPr5  r(  r  r&  )r   terminal_typeewr  r,  remstrrestr  r   r   r!   rW   charsvtexts   &&            r   get_encoded_wordrF  "  s@    
BD!!%%077>@ 	@BioodA.OC
Bi%%077>@ 	@WWYFFaq	Yq	Y		#!<<a0Dj4
399;!


&44,. 	/FGGIE@'*zz$*t2C'D$t JGJJg
7c>!$-KEIIe)$2e3
		%wwy!q$


&44<> 	?9) ! @/66rvv>@ 	@@s   6'J 6Kc                    \        4       pV '       Ed   V ^ ,          \        9   d!   \        V 4      w  r VP                  V4       K;  RpV P	                  R4      '       d    \        V R4      w  r Rp\        V4      ^ 8  dJ   VR	,          P                  R8w  d2   VP                  P                  \        P                  ! R4      4       RpV'       d?   \        V4      ^8  d/   VR
,          P                  R8X  d   \        VR	,          R4      VR	&   VP                  V4       EK  \        V ^4      vrVV'       d.   \        P!                  V4      '       d   V P#                  R4      vrV\%        VR4      p\'        V4       VP                  V4       RP)                  V4      p EK  V#   \         d    Rp L\        P                   d     Li ; i)r   Tr7  utextr3  z&missing whitespace before encoded wordFr   r(   r  )r   r?  r5  r   r9  rF  r  rl   r!   r   r  r  r  r:  r(  rfc2047_matchersearch	partitionr  r&  r3   )r   r   rW   valid_ewhave_wsr  r,  rE  s   &       r   get_unstructuredrO  S  s   . )*L
%8s?"5>LE&D!!/w? |$q(#B'22e;$,,33F4N4ND5F G"'s<014#B'22nD+?(,e,5R(##E*'q1 ..s33#ood3OCc7+E"	"A # ! **  s    F# #G	2G	G	G	c                 T    \        V R 4      w  rp\        VR4      p\        V4       W3# )z()r  )r1  r  r&  r   r  _s   &  r   get_qp_ctextrS    s0     -UD9OE!ug.EE<r   c                 T    \        V R 4      w  rp\        VR4      p\        V4       W3# )r   r  )r1  r  r&  rQ  s   &  r   get_qcontentrU    s0     -UC8OE!%)EE<r   c                     \        V 4      pV'       g&   \        P                  ! R P                  V 4      4      hVP	                  4       pV \        V4      R p \        VR4      p\        V4       W 3# )zexpected atext but found '{}'Natext)_non_atom_end_matcherr   r:  r:   r   r  r  r&  )r   mrW  s   &  r   	get_atextrZ    si     	e$A%%+2259; 	;GGIE#e*+E%)EE<r   c                    V '       d   V ^ ,          R8w  d&   \         P                  ! RP                  V 4      4      h\        4       pV R,          p V '       d-   V ^ ,          R8X  d   \	        V 4      w  r VP                  V4       V '       d   V ^ ,          R8w  d   V ^ ,          \        9   d   \        V 4      w  r MV R,          R8X  d   Rp \        V 4      w  r VP                  P                  \         P                  ! R4      4       RpV'       dW   \        V4      ^8  dG   VR,          P                  R	8X  d/   VR,          P                  R
8X  d   \        VR,          R	4      VR&   M\	        V 4      w  r VP                  V4       EK  V '       g3   VP                  P                  \         P                  ! R4      4       W3# WR,          3#   \         P                   d    \	        T 4      w  r  Li ; i)r   r   zexpected '"' but found '{}'rv  :Nr  Nr7  Fz!encoded word inside quoted stringTr3  r   z"end of header inside quoted stringr  rI  )r   r:  r:   r   rU  r   r?  r5  rF  r!   r  r  rl   r  )r   bare_quoted_stringrW   rM  s   &   r   get_bare_quoted_stringr]    s    E!HO%%*11%8: 	:)+"IEqS#E*!!%(
E!HO8s?"5>LE52Y$H3/6"**11&2L2L739 :
 C 23a7&r*55>*2.99^K-A*2..7&r* (.LE!!%(""))&*D*D0+2 	3!((Ry((! ** 3+E2u3s   
>G "G10G1c                 
   V '       d4   V ^ ,          R8w  d&   \         P                  ! RP                  V 4      4      h\        4       pV R,          p V '       dk   V ^ ,          R8w  d]   V ^ ,          \        9   d   \        V 4      w  r M)V ^ ,          R8X  d   \        V 4      w  r M\        V 4      w  r VP                  V4       Kr  V '       g3   VP                  P                  \         P                  ! R4      4       W3# WR,          3# )r   r   zexpected '(' but found '{}'rv  r   zend of header inside comment)r   r:  r:   r   r?  r5  get_commentrS  r   r!   r  )r   r   rW   s   &  r   r_  r_    s     qS%%)0079 	9iG"IE
E!HO8s?"5>LE51X_&u-LE5'.LEuv99* , 	-~"Ir   c                     \        4       pV '       dS   V ^ ,          \        9   dA   V ^ ,          \        9   d   \        V 4      w  r M\	        V 4      w  r VP                  V4       KZ  W3# rJ   )r   CFWS_LEADERr?  r5  r_  r   )r   r   rW   s   &  r   get_cfwsrb  
  sQ     :D
E!H+8s?"5>LE5&u-LEE;r   c                 8   \        4       pV '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       \	        V 4      w  r VP                  V4       V '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       W3# rJ   )r   ra  rb  r   r]  )r   quoted_stringrW   s   &  r   get_quoted_stringre    s|     !NMq[(U#)%0LEq[(U#r   c                 R   \        4       pV '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       V '       d8   V ^ ,          \        9   d&   \
        P                  ! RP                  V 4      4      hV P                  R4      '       d    \        V 4      w  r M\        V 4      w  r VP                  V4       V '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       W3#   \
        P                   d    \        T 4      w  r  Lpi ; i)r   zexpected atom but found '{}'r7  )r   ra  rb  r   	ATOM_ENDSr   r:  r:   r9  rF  rZ  )r   r   rW   s   &  r   get_atomrh  )  s    
 6Dq[(EqY&%%*11%8: 	:	,+E2LE5 !'KKq[(E; && 	, %U+LE5	,s   D "D&%D&c                    \        4       pV '       d   V ^ ,          \        9   d&   \        P                  ! RP	                  V 4      4      hV '       dk   V ^ ,          \        9  dY   \        V 4      w  r VP                  V4       V '       g   KB  V ^ ,          R8X  g   KR  VP                  \        4       V R,          p Kr  VR,          \        J d-   \        P                  ! RP	                  RV ,           4      4      hW3# )r   z8expected atom at a start of dot-atom-text but found '{}'r	   rv  z4expected atom at end of dot-atom-text but found '{}'r  )r[  rg  r   r:  r:   rZ  r   r  )r   dot_atom_textrW   s   &  r   get_dot_atom_textrk  D  s      MME!H	)%% '++16%=: 	:
E!HI- 'U#5U1X_  %"IERC%% '#VCI.0 	0r   c                    \        4       pV ^ ,          \        9   d   \        V 4      w  r VP                  V4       V P	                  R4      '       d    \        V 4      w  r M\        V 4      w  r VP                  V4       V '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       W3#   \        P                   d    \        T 4      w  r  Lpi ; i)r   r7  )	rX  ra  rb  r   r9  rF  r   r:  rk  )r   dot_atomrW   s   &  r   get_dot_atomrn  W  s     yHQx;	4+E2LE5 )/OOEq[(? && 	4 -U3LE5	4s   B: :"CCc                 \   V ^ ,          \         9   d   \        V 4      w  rMRpV '       g   \        P                  ! R4      hV ^ ,          R8X  d   \	        V 4      w  r MDV ^ ,          \
        9   d&   \        P                  ! RP                  V 4      4      h\        V 4      w  r Ve   V.VR&   W 3# )r   Nz5Expected 'atom' or 'quoted-string' but found nothing.r   z1Expected 'atom' or 'quoted-string' but found '{}'Nr   N)ra  rb  r   r:  re  SPECIALSr:   rh  )r   leaderrW   s   &  r   get_wordrs  p  s      Qx; %%CE 	EQx}(/u	qX	%% '77=ve}F 	F  Hb	<r   c                    \        4       p \        V 4      w  r VP                  V4       V '       d   V ^ ,          \        9  d   V ^ ,          R8X  dP   VP                  \        4       VP
                  P                  \        P                  ! R4      4       V R,          p Kw   \        V 4      w  r TP                  T4       K  W3#   \        P                   d3    TP
                  P                  \        P                  ! R 4      4        Li ; i  \        P                   dS    T ^ ,          \        9   d?   \        T 4      w  r TP
                  P                  \        P                  ! R4      4        Lh i ; i)zphrase does not start with wordr	   zperiod in 'phrase'rv  zcomment found without atom)r   rs  r   r   r:  r!   r  PHRASE_ENDSr  ObsoleteHeaderDefectra  rb  )r   r   rW   s   &  r   
get_phraserw    s,    XF0e E!HK/8S=MM#NN!!&"="=$#& '"IE' MM% =) "" 0f88-/ 	00 ** 8{*#+E?LENN))&*E*E4+6 7 s%   C "D ADDA#E64E6c                 ,   \        4       pR pV '       d    V ^ ,          \        9   d   \        V 4      w  r V '       g&   \        P                  ! RP                  V 4      4      h \        V 4      w  r0Te   T.TR&   TP                  T4       T '       d   T ^ ,          R8X  g   T ^ ,          \        9  d   \        \        T4      T ,           4      w  r@TP                  R8X  d1   TP                  P                  \        P                  ! R4      4       M/TP                  P                  \        P                   ! R4      4       YA^ &    TP"                  P%                  R4       Y3#   \        P                   d[     \        T 4      w  r0 EL  \        P                   d1    T ^ ,          R8w  d   T ^ ,          \        9   d   h \        4       p  EL]i ; ii ; i  \&         d5    TP                  P                  \        P(                  ! R4      4        Y3# i ; i)	Nz"expected local-part but found '{}'r   rp  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  ra  rb  r   r:  r:   rn  rs  ru  r   r   get_obs_local_partr   rl   r!   r  rv  r   encoder  NonASCIILocalPartDefect)r   r  rr  rW   obs_local_parts   &    r   get_local_partr    s    JFq[( %%077>@ 	@ #E* Hb	e%(D.E!HK$? 23z?U3J K$$(@@%%f&@&@N'P Q %%f&A&A>'@ A&1>( 1 ""  	 #E?LE5&& 	 Qx4E!H$;KE	  *  >!!&"@"@;#= 	>>s=   "E" G "G8FA GGGG:HHc                     \        4       pR pV '       Edh   V ^ ,          R8X  g   V ^ ,          \        9  EdG   V ^ ,          R8X  dZ   V'       d0   VP                  P                  \        P
                  ! R4      4       VP                  \        4       RpV R,          p K  V ^ ,          R8X  d_   VP                  \        V ^ ,          R4      4       V R,          p VP                  P                  \        P
                  ! R4      4       R pK  V'       dH   VR,          P                  R8w  d0   VP                  P                  \        P
                  ! R	4      4        \        V 4      w  r0R pVP                  V4       EKp  V'       g&   \        P                  ! R
P                  V 4      4      hV^ ,          P                  R8X  gA   V^ ,          P                  R8X  dX   \        V4      ^8  dH   V^,          P                  R8X  d0   VP                  P                  \        P
                  ! R4      4       VR,          P                  R8X  gA   VR,          P                  R8X  dX   \        V4      ^8  dH   VR,          P                  R8X  d0   VP                  P                  \        P
                  ! R4      4       VP                  '       d   RVn        W3#   \        P                   d%    T ^ ,          \        9  d   h \        T 4      w  r0 ELi ; i)Fr   r	   zinvalid repeated '.'Trv  misplaced-specialz/'\' character outside of quoted-string/ccontentr  zmissing '.' between wordsz&expected obs-local-part but found '{}'r   z!Invalid leading '.' in local partz"Invalid trailing '.' in local partry  r  rI  )rr  ru  r!   r   r   r  r  r  rl   rs  r:  ra  rb  r:   r  )r   r~  last_non_ws_was_dotrW   s   &   r   r{  r{    s    "^N
%U1Xt^uQx{'B8s?"&&--f.H.H*/, -!!#&"&"IE1Xt^!!-a0C#E F"IE""))&*D*DB+D E"'nR0;;uD""))&*D*D++- .	+#E?LE"'
 	e$%%4;;EBD 	Dq$$-1((&0!#1((%/%%f&@&@/'1 	2r%%.2))61!#2))50%%f&@&@0'2 	3$<!  - && 	+Qx{*#E?LE5	+s   K 5LLc                     \        V R 4      w  rp\        VR4      pV'       d0   VP                  P                  \        P
                  ! R4      4       \        V4       W3# )z[]r  z(quoted printable found in domain-literal)r1  r  r!   r   r   rv  r&  )r   r  r/  s   &  r   	get_dtextr    sV     2%>E&%)EV8868 	9E<r   c                     V '       d   R # VP                   P                  \        P                  ! R4      4       VP                  \	        RR4      4       R# )Fz"end of input inside domain-literal]domain-literal-endT)r!   r   r   r  r  )r   domain_literals   &&r   _check_for_early_dl_endr  '  sE    !!&"<"<,#. /--ABCr   c                    \        4       pV ^ ,          \        9   d   \        V 4      w  r VP                  V4       V '       g   \        P
                  ! R4      hV ^ ,          R8w  d&   \        P
                  ! RP                  V 4      4      hV R,          p VP                  \        RR4      4       \        W4      '       d   W3# V ^ ,          \        9   d   \        V 4      w  r VP                  V4       \        V 4      w  r VP                  V4       \        W4      '       d   W3# V ^ ,          \        9   d   \        V 4      w  r VP                  V4       \        W4      '       d   W3# V ^ ,          R8w  d&   \        P
                  ! RP                  V 4      4      hVP                  \        RR4      4       V R,          p V '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       W3# )	r   zexpected domain-literal[z6expected '[' at start of domain-literal but found '{}'rv  zdomain-literal-startr  z4expected ']' at end of domain-literal but found '{}'r  )r  ra  rb  r   r   r:  r:   r  r  r?  r5  r  )r   r  rW   s   &  r   get_domain_literalr  /  s    #_NQx;e$%%&?@@Qx3%% '!!'0 	0"IE--CDEu55$$Qx3u~e$U#LE% u55$$Qx3u~e$u55$$Qx3%% '!!'0 	0--ABC"IEq[(e$  r   c                    \        4       pR pV '       d    V ^ ,          \        9   d   \        V 4      w  r V '       g&   \        P                  ! RP                  V 4      4      hV ^ ,          R8X  d,   \        V 4      w  r0Ve   V.VR&   VP                  V4       W3#  \        V 4      w  r0V '       d%   V ^ ,          R8X  d   \        P                  ! R4      hVe   V.VR&   VP                  V4       V '       d   V ^ ,          R8X  d   VP                  P                  \        P                  ! R4      4       V^ ,          P                  R8X  d   V^ ,          VR	&   V '       dK   V ^ ,          R8X  d=   VP                  \        4       \        V R
,          4      w  r0VP                  V4       KR  W3#   \        P                   d    \        T 4      w  r0 EL*i ; i)Nzexpected domain but found '{}'r  rp  rk  zInvalid Domainr	   z(domain is not a dot-atom (contains CFWS)rY  NNNrv  )rQ  ra  rb  r   r:  r:   r  r   rn  rh  r!   rv  rl   r  )r   r   rr  rW   s   &   r   
get_domainr  V  s   
 XFFq[( %%,33E:< 	<Qx3)%0E"Ie}'#E* qS%%&677Hb	
MM%qSf9968 	9!9:-q	F1IaCMM##E"I.LEMM% =! "" 'u's   F- -"GGc                 h   \        4       p\        V 4      w  r VP                  V4       V '       d   V ^ ,          R8w  d3   VP                  P                  \        P
                  ! R4      4       W3# VP                  \        RR4      4       \        V R,          4      w  r VP                  V4       W3# )r   rk  z#addr-spec local part with no domainaddress-at-symbolrv  )r`  r  r   r!   r   r  r  r  )r   r'  rW   s   &  r   get_addr_specr  |  s     
I!%(LEUE!HO  !;!;1"3 	4]3(;<=eBi(LEUr   c                    \        4       pV '       d   V ^ ,          R8X  g   V ^ ,          \        9   dc   V ^ ,          \        9   d!   \        V 4      w  r VP                  V4       KZ  V ^ ,          R8X  g   Kj  VP                  \        4       V R,          p K  V '       d   V ^ ,          R8w  d&   \
        P                  ! RP                  V 4      4      hVP                  \        4       \        V R,          4      w  r VP                  V4       V '       d   V ^ ,          R8X  d   VP                  \        4       V R,          p V '       g   MV ^ ,          \        9   d   \        V 4      w  r VP                  V4       V '       g   MLV ^ ,          R8X  g   K  VP                  \        4       \        V R,          4      w  r VP                  V4       K  V '       g   \
        P                  ! R4      hV ^ ,          R8w  d&   \
        P                  ! RP                  V 4      4      hVP                  \        RR4      4       WR,          3# )	r   r   rv  rk  z(expected obs-route domain but found '{}'z%end of header while parsing obs-route:z4expected ':' marking end of obs-route but found '{}'zend-of-obs-route-marker)r:  ra  rb  r   ListSeparatorr   r:  r:   RouteComponentMarkerr  r  )r   	obs_routerW   s   &  r   get_obs_router    s    
I
U1Xs]eAh+&=8{"#E?LEU#1X_]+"IEE!HO%%6==eDF 	F)*eBi(LEU
E!HcM'b	8{"#E?LEU#8s?12%eBi0LEU#%%&MNNQx3%% (''-ve}6 	6]3(ABCBir   c                    \        4       pV '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       V '       d   V ^ ,          R8w  d&   \        P
                  ! RP                  V 4      4      hVP                  \        RR4      4       V R,          p V '       de   V ^ ,          R8X  dW   VP                  \        RR4      4       VP                  P                  \        P                  ! R4      4       V R,          p W3#  \        V 4      w  r TP                  T4       T '       d   T ^ ,          R8X  d   T R,          p M/TP                  P                  \        P                  ! R
4      4       TP                  \        RR4      4       T '       d1   T ^ ,          \        9   d   \        T 4      w  r TP                  T4       Y3#   \        P
                   d     \        T 4      w  r TP                  P                  \        P                  ! R4      4       M>  \        P
                   d'    \        P
                  ! R	P                  T 4      4      hi ; iTP                  T4       \        T 4      w  r  ELhi ; i)r   <z"expected angle-addr but found '{}'zangle-addr-startrv  >zangle-addr-endznull 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+  ra  rb  r   r   r:  r:   r  r!   r  r  r  rv  )r   
angle_addrrW   s   &  r   get_angle_addrr    s"   
 Jq[(% E!HO%%077>@ 	@mC);<="IE qS--=>?!!&"<"<*#, 	-b	  ,$U+ eqSb	!!&"<"<0#2 	3mC)9:;q[(% ) "" 	,	P(/LE%%f&A&A<'> ?&& 	P))@GGNP P	P 	% $U+u	,s*   G J(<H%$J%;I  !JJc                     \        4       p\        V 4      w  r VP                  VR ,          4       VP                  R ,          Vn        W3# )r  )rt  rw  rU   r!   )r   r   rW   s   &  r   get_display_namer    sC     =Le$LEa! ==+Lr   c                    \        4       pR pV '       g&   \        P                  ! RP                  V 4      4      hV ^ ,          \        9   d;   \        V 4      w  r V '       g&   \        P                  ! RP                  V4      4      hV ^ ,          R8w  d   V ^ ,          \        9   d&   \        P                  ! RP                  V 4      4      h\        V 4      w  r0V '       g&   \        P                  ! RP                  V4      4      hVe4   \        V^ ,          \        4      '       d   V.V^ ,          R&   MV.VR&   R pVP                  V4       \        V 4      w  r0Ve   V.VR&   VP                  V4       W3# )Nz!expected name-addr but found '{}'r  rp  )r  r   r:  r:   ra  rb  ru  r  rx  r   r   r  )r   	name_addrrr  rW   s   &   r   get_name_addrr    sU    
IF%%/66u=? 	?Qx; ))3::6BD DQx38{"))3::5AC C'.))3::5AC C%(I.. &xa#Hb	F!%(LEHb	Ur   c                    \        4       p \        V 4      w  r \        ;QJ d&    R TP                   4       F  '       g   K   RM	  RM! R TP                   4       4      '       d   RTn        TP                  T4       Y3#   \        P                   dP     \	        T 4      w  r  L  \        P                   d'    \        P                  ! R P                  T 4      4      hi ; ii ; i)zexpected mailbox but found '{}'c              3   V   "   T F  p\        V\        P                  4      x  K!  	  R # 5ir   )rx  r   r  r+   s   & r   r.   get_mailbox.<locals>.<genexpr>'  s'      3 11 a3344 1   ')TFr   )
r>  r  r   r:  r  r:   anyrE   rl   r   )r   r   rW   s   &  r   get_mailboxr    s     iGA$U+ s 3 % 1 13sss 3 % 1 13 3 3.NN5> "" A	A(/LE5&& 	A))188?A A	AAs   B C&B'';C""C&c                    \        4       pV '       dn   V ^ ,          V9  d`   V ^ ,          \        9   d.   VP                  \        V ^ ,          R4      4       V R,          p KU  \	        V 4      w  r0VP                  V4       Ku  W 3# )r   r  rv  )rL  ru  r   r  rw  )r   r*  invalid_mailboxrW   s   &&  r   get_invalid_mailboxr  -  sr     %&O
E!HH,8{"""=q1D$F G"IE%e,LE""5)!!r   c                    \        4       pV '       d   V ^ ,          R8w  d    \        V 4      w  r VP                  V4       V '       dm   V ^ ,          R9  d_   VR
,          pRVn        \        V R4      w  r VP                  V4       VP                  P                  \        P                  ! R4      4       V '       g   K  V ^ ,          R8X  g   K  VP                  \        4       V R	,          p K  W3#   \        P                   Edr    RpT ^ ,          \
        9   d   \        T 4      w  r0T '       d   T ^ ,          R9   dD   TP                  T4       TP                  P                  \        P                  ! R4      4        ELA\        T R4      w  r Te   T.TR&   TP                  T4       TP                  P                  \        P                  ! R4      4        ELT ^ ,          R8X  d3   TP                  P                  \        P                  ! R4      4        EL\        T R4      w  r Te   T.TR&   TP                  T4       TP                  P                  \        P                  ! R4      4        EL7i ; i)r   ;Nz,;zempty element in mailbox-listrp  zinvalid mailbox in mailbox-listr   r   rv  r  )r   r  r   r   r:  ra  rb  r!   rv  r  r  rl   rU   r  )r   mailbox_listrW   rr  r   s   &    r   get_mailbox_listr  ?  s    =L
E!HO	8&u-LE&4 U1XT) #2&G!2G.ud;LENN5!  ''(B(B1)3 45U1X_."IEK && 	8FQx;& (aD 0 ''/ ((//0K0K719 : $7ud#CLE)%+Hb	 ''. ((//0J0J91; <qS$$++F,G,G3-5 6  35$?%!'E"I##E*$$++F,F,F5-7 8/	8s&   C1 1BI8AI8=I8AI87I8c                    \        4       pV '       g3   VP                  P                  \        P                  ! R 4      4       W3# RpV '       d   V ^ ,          \
        9   d{   \        V 4      w  r V '       gD   VP                  P                  \        P                  ! R4      4       VP                  V4       W3# V ^ ,          R8X  d   VP                  V4       W3# \        V 4      w  r0\        VP                  4      ^ 8X  dY   Ve   VP                  V4       VP                  V4       VP                  P                  \        P                  ! R4      4       W3# Ve   V.VR&   VP                  V4       W3# )zend of header before group-listNzend of header in group-listr  zgroup-list with empty entriesrp  )r   r!   r   r   r  ra  rb  r  r  r   rU   rv  )r   
group_listrr  rW   s   &   r   get_group_listr  x  sQ   
 J!!&"<"<-#/ 	0  Fq[(  %%f&@&@-'/ 0f%$$8s?f%$$#E*LE
5"f%% !!&"="=+#- 	.  Hb	er   c                 V   \        4       p\        V 4      w  r V '       d   V ^ ,          R8w  d&   \        P                  ! RP	                  V 4      4      hVP                  V4       VP                  \        RR4      4       V R,          p V '       d4   V ^ ,          R8X  d&   VP                  \        RR4      4       WR,          3# \        V 4      w  r VP                  V4       V '       g1   VP                  P                  \        P                  ! R4      4       M3V ^ ,          R8w  d&   \        P                  ! RP	                  V 4      4      hVP                  \        RR4      4       V R,          p V '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       W3# )	r   r  z8expected ':' at end of group display name but found '{}'zgroup-display-name-terminatorrv  r  zgroup-terminatorzend of header in groupz)expected ';' at end of group but found {})r  r  r   r:  r:   r   r  r  r!   r  ra  rb  )r   r   rW   s   &  r   	get_groupr    sQ    GE#E*LEE!HO%% '**0&-9 	9	LL	LLs$CDE"IEqS]3(:;<Bi!%(LE	LLV77$& 	'	qS%%7>>uEG 	G	LLs$678"IEq[(U<r   c                 (   \        4       p \        V 4      w  r TP                  T4       Y3#   \        P                   dP     \	        T 4      w  r  L9  \        P                   d'    \        P                  ! R P                  T 4      4      hi ; ii ; i)zexpected address but found '{}')r   r  r   r:  r  r:   r   )r   r   rW   s   &  r   get_addressr    s    " iGA ' NN5> "" A	A&u-LE5&& 	A))188?A A	AAs   - BA;BBc                    \        4       pV '       d    \        V 4      w  r VP                  V4       V '       dt   V ^ ,          R8w  df   VR,          ^ ,          pRVn        \        V R4      w  r VP                  V4       VP                  P                  \        P                  ! R4      4       V '       g   K  VP                  \        4       V R,          p K  W3#   \        P                   Ed    R pT ^ ,          \
        9   d   \        T 4      w  r0T '       d   T ^ ,          R8X  dD   TP                  T4       TP                  P                  \        P                  ! R4      4        EL8\        T R4      w  r Te   T.TR&   TP                  \        T.4      4       TP                  P                  \        P                  ! R4      4        ELT ^ ,          R8X  d3   TP                  P                  \        P                  ! R4      4        EL\        T R4      w  r Te   T.TR&   TP                  \        T.4      4       TP                  P                  \        P                  ! R4      4        ELBi ; i)	Nr   z"address-list entry with no contentrp  zinvalid address in address-listzempty element in address-listr   rv  r  )r   r  r   r   r:  ra  rb  r!   rv  r  r   r  rl   rU   r  )r   address_listrW   rr  r   s   &    r   get_address_listr    s    =L
	8&u-LE&4 U1X_ #2&q)G!2G.uc:LENN5!  ''(B(B1)3 45."IEK && 	8FQx;& (aC ''/ ((//0K0K<1> ? $7uc#BLE)%+Hb	 ''(89 ((//0J0J91; <qS$$++F,G,G3-5 6  35#>%!'E"I##GUG$45$$++F,F,F5-7 8/	8s&   C BI5*A"I5=I5A"I54I5c                    \        4       pV '       g&   \        P                  ! R P                  V 4      4      hV ^ ,          R8w  d&   \        P                  ! RP                  V 4      4      hVP	                  \        RR4      4       V R,          p \        V 4      w  r VP	                  V4       V '       d   V ^ ,          R8w  d&   \        P                  ! RP                  V 4      4      hVP	                  \        RR4      4       WR,          3# )z'expected no-fold-literal but found '{}'r  z;expected '[' at the start of no-fold-literal but found '{}'zno-fold-literal-startrv  r  z9expected ']' at the end of no-fold-literal but found '{}'zno-fold-literal-end)r^  r   r:  r:   r   r  r  )r   no_fold_literalrW   s   &  r   get_no_fold_literalr    s     $oO%%5<<UCE 	EQx3%%#VE], 	, =.EFG"IEU#LE5!E!HO%%#VE], 	, =.CDE"I%%r   c                    \        4       pV '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       V '       d   V ^ ,          R8w  d&   \        P
                  ! RP                  V 4      4      hVP                  \        RR4      4       V R,          p  \        V 4      w  r TP                  T4       T '       d   T ^ ,          R8w  dm   TP                  P                  \        P                  ! R4      4       T '       d3   T ^ ,          R	8X  d%   TP                  \        R	R
4      4       T R,          p Y3# TP                  \        RR4      4       T R,          p  \        T 4      w  r TP                  T4       T '       d   T ^ ,          R	8X  d   T R,          p M/TP                  P                  \        P                  ! R4      4       TP                  \        R	R
4      4       T '       d1   T ^ ,          \        9   d   \        T 4      w  r TP                  T4       Y3#   \        P
                   d     \        T 4      w  r TP                  P                  \        P                  ! R4      4        EL  \        P
                   d'    \        P
                  ! RP                  T 4      4      hi ; ii ; i  \        P
                   d     \        T 4      w  r  ELs  \        P
                   d     \        T 4      w  r TP                  P                  \        P                  ! R4      4         EL  \        P
                   d'    \        P
                  ! RP                  T 4      4      hi ; ii ; ii ; i)r   r  zexpected msg-id but found '{}'zmsg-id-startrv  zobsolete id-left in msg-idz4expected dot-atom-text or obs-id-left but found '{}'rk  zmsg-id with no id-rightr  z
msg-id-endr  zobsolete id-right in msg-idzFexpected dot-atom-text, no-fold-literal or obs-id-right but found '{}'zmissing trailing '>' on msg-id)r  ra  rb  r   r   r:  r:   r  rk  r{  r!   rv  r  r  r  )r   msg_idrW   s   &  r   
get_msg_idr  %  s    WFq[(eE!HO%%,33E:< 	<
MM-^45"IE1(/ MM%E!HOf88%' 	(
 U1X_MM-\:;"IE}
MM-%89:"IE5(/ MM%qSb	f88,. 	/
MM-\23q[(e=a "" 	1	1-e4LENN!!&"="=,#. /&& 	1))""(&-1 1	1	14 "" 5
	5.u5LE5&& 	55)%0%%f&A&A1'3 4 4** 5--&&,fUm5 55	55sT   #H+ (K +J?<J  ;J;;J?NK((M=><L>:N>;M99M==Nc                    \        4       p \        V 4      w  r VP                  V4       V '       d?   VP                  P                  \        P
                  ! R P                  V 4      4      4       V#   \        P                   d`   p\        T 4      p\        T4      pTP                  P                  \        P
                  ! RP                  T4      4      4        Rp?T# Rp?ii ; i)zUnexpected {!r}zInvalid msg-id: {!r}N)
r  r  r   r!   r   r  r:   r:  rO  r  )r   
message_idrW   exs   &   r   parse_message_idr  j  s     J2!%(%  %%f&@&@!((/'1 2  "" K '%e,
!!&&'='D'DR'HI	K 	K Ks   A2 2C&AC!!C&c                 t   \        4       pV '       g2   VP                  P                  \        P                  ! R 4      4       V# V ^ ,          \
        9   dV   \        V 4      w  r VP                  V4       V '       g0   VP                  P                  \        P                  ! R4      4       RpV '       d;   V ^ ,          R8w  d-   V ^ ,          \
        9  d   W0^ ,          ,          pV R,          p KB  VP                  4       '       g[   VP                  P                  \        P                  ! RP                  V4      4      4       VP                  \        VR4      4       M+\        V4      Vn        VP                  \        VR4      4       V '       d1   V ^ ,          \
        9   d   \        V 4      w  r VP                  V4       V '       d   V ^ ,          R8w  dc   VP                  e0   VP                  P                  \        P                  ! R4      4       V '       d   VP                  \        V R4      4       V# VP                  \        RR	4      4       V R,          p V '       d1   V ^ ,          \
        9   d   \        V 4      w  r VP                  V4       V '       g@   VP                  e0   VP                  P                  \        P                  ! R4      4       V# RpV '       d-   V ^ ,          \
        9  d   W0^ ,          ,          pV R,          p K4  VP                  4       '       g[   VP                  P                  \        P                  ! R
P                  V4      4      4       VP                  \        VR4      4       M+\        V4      Vn        VP                  \        VR4      4       V '       d1   V ^ ,          \
        9   d   \        V 4      w  r VP                  V4       V '       dK   VP                  P                  \        P                  ! R4      4       VP                  \        V R4      4       V# )z%Missing MIME version number (eg: 1.0)z0Expected MIME version number but found only CFWSr(   r	   rv  z1Expected MIME major version number but found {!r}r$  digitsz0Incomplete MIME version; found only major numberzversion-separatorz1Expected MIME minor version number but found {!r}z'Excess non-CFWS text after MIME version)r  r!   r   r   HeaderMissingRequiredValuera  rb  isdigitr  r:   r  intr  r  )r   mime_versionrW   r  s   &   r   parse_mime_versionr    s6    =L##F$E$E3%5 	6Qx;E"  ''(I(IB)D EF
E!HOa(C(b	>>##F$>$>?FFvN%P 	QM&':; [M&(;<q[(E"E!HO)  ''(B(BB)D EeW =>c+>?@"IEq[(E")  ''(B(BB)D EF
E!HK/(b	>>##F$>$>?FFvN%P 	QM&':; [M&(;<q[(E"##F$>$>5%7 	8M%9:r   c                    \        4       pV '       dn   V ^ ,          R8w  d`   V ^ ,          \        9   d.   VP                  \        V ^ ,          R4      4       V R,          p KU  \	        V 4      w  r VP                  V4       Ku  W3# )r   r  r  rv  )r  ru  r   r  rw  )r   invalid_parameterrW   s   &  r   get_invalid_parameterr    sr     )*
E!HO8{"$$]583F&H I"IE%e,LE$$U+##r   c                     \        V 4      pV'       g&   \        P                  ! R P                  V 4      4      hVP	                  4       pV \        V4      R p \        VR4      p\        V4       W 3# )zexpected ttext but found '{}'Nttext)_non_token_end_matcherr   r:  r:   r   r  r  r&  )r   rY  r  s   &  r   	get_ttextr    si     	u%A%%+2259; 	;GGIE#e*+E%)EE<r   c                    \        4       pV '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       V '       d8   V ^ ,          \        9   d&   \
        P                  ! RP                  V 4      4      h\        V 4      w  r VP                  V4       V '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       W3# r   zexpected token but found '{}')	r   ra  rb  r   
TOKEN_ENDSr   r:  r:   r  )r   mtokenrW   s   &  r   	get_tokenr    s     WFq[(eqZ'%%+2259; 	;U#LE
MM%q[(e=r   c                     \        V 4      pV'       g&   \        P                  ! R P                  V 4      4      hVP	                  4       pV \        V4      R p \        VR4      p\        V4       W 3# )z expected attrtext but found {!r}Nr  )_non_attribute_end_matcherr   r:  r:   r   r  r  r&  r   rY  r  s   &  r   get_attrtextr  	  si     	#5)A%%.55e<> 	>wwyH#h-.!EXz2HH?r   c                    \        4       pV '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       V '       d8   V ^ ,          \        9   d&   \
        P                  ! RP                  V 4      4      h\        V 4      w  r VP                  V4       V '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       W3# r  )	r  ra  rb  r   ATTRIBUTE_ENDSr   r:  r:   r  r   r  rW   s   &  r   get_attributer  	  s     Iq[(q^+%%+2259; 	;&LEUq[(r   c                     \        V 4      pV'       g&   \        P                  ! R P                  V 4      4      hVP	                  4       pV \        V4      R p \        VR4      p\        V4       W 3# )z)expected extended attrtext but found {!r}Nextended-attrtext)#_non_extended_attribute_end_matcherr   r:  r:   r   r  r  r&  r  s   &  r   get_extended_attrtextr  0	  sl     	,E2A%%7>>uEG 	GwwyH#h-.!EX':;HH?r   c                    \        4       pV '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       V '       d8   V ^ ,          \        9   d&   \
        P                  ! RP                  V 4      4      h\        V 4      w  r VP                  V4       V '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       W3# r  )	r  ra  rb  r   EXTENDED_ATTRIBUTE_ENDSr   r:  r:   r  r  s   &  r   get_extended_attributer  B	  s     Iq[(q44%%+2259; 	;(/LEUq[(r   c                    \        4       pV '       d   V ^ ,          R8w  d&   \        P                  ! RP                  V 4      4      hVP	                  \        RR4      4       V R,          p V '       d   V ^ ,          P                  4       '       g&   \        P                  ! RP                  V 4      4      hRpV '       d8   V ^ ,          P                  4       '       d   W ^ ,          ,          pV R,          p K?  V^ ,          R8X  d7   VR8w  d0   VP                  P	                  \        P                  ! R4      4       \        V4      Vn
        VP	                  \        VR	4      4       W3# )
r   *zExpected section but found {}zsection-markerrv  z$Expected section number but found {}r(   0z'section number has an invalid leading 0r  )r  r   r:  r:   r   r  r  r!   r  r  r  )r   r  r  s   &  r   get_sectionr  X	  s    iGE!HO%%&E&L&L(-'/ 0 	0NN=&678"IEa((**%% '117@ 	@F
E!H$$&&(b	ayCFcMv999 ; 	<[GNNN=23>r   c                 |   \        4       pV '       g   \        P                  ! R 4      hRpV ^ ,          \        9   d   \	        V 4      w  r V '       g&   \        P                  ! RP                  V4      4      hV ^ ,          R8X  d   \        V 4      w  r0M\        V 4      w  r0Ve   V.VR&   VP                  V4       W3# )z&Expected value but found end of stringNz Expected value but found only {}r   rp  )	r  r   r:  ra  rb  r:   re  r  r   )r   vrr  rW   s   &   r   	get_valuer  v	  s     	A%%&NOOFQx; %% '006v@ 	@Qx3(/u-e4Hb	HHUO8Or   c                    \        4       p\        V 4      w  r VP                  V4       V '       d   V ^ ,          R8X  dB   VP                  P                  \        P
                  ! RP                  V4      4      4       W3# V ^ ,          R8X  d~    \        V 4      w  r RVn        VP                  V4       V '       g   \        P                  ! R4      hV ^ ,          R8X  d,   VP                  \        RR4      4       V R,          p RVn        V ^ ,          R8w  d   \        P                  ! R	4      hVP                  \        RR
4      4       V R,          p V '       d1   V ^ ,          \        9   d   \        V 4      w  r VP                  V4       RpTpVP                  '       Ed;   V '       Ed2   V ^ ,          R8X  Ed#   \        V 4      w  rSVP                  pRpVP                   ^ 8X  d@   V'       d   V^ ,          R8X  d   RpM>\#        V4      w  r(V'       d   V^ ,          R8X  d   RpM \%        V4      w  r(V'       g   RpV'       dg   VP                  P                  \        P
                  ! R4      4       VP                  V4       V F  p	V	P&                  R8X  g   K  . V	R&   T	p M	  Tp M1RpVP                  P                  \        P
                  ! R4      4       V '       d   V ^ ,          R8X  d   RpM\)        V 4      w  r VP                  '       d   VP                   ^ 8  d`   V '       d   V ^ ,          R8w  d   VP                  V4       Ve   Tp W3# VP                  P                  \        P
                  ! R4      4       V '       gJ   VP                  P                  \        P
                  ! R4      4       VP                  V4       Vf   W3# EMLVeN   V F  p	V	P&                  R8X  g   K   M	  X	P&                  R8H   VP                  V	4       V	P*                  Vn        V ^ ,          R8w  d&   \        P                  ! RP                  V 4      4      hVP                  \        RR4      4       V R,          p V '       dy   V ^ ,          R8w  dk   \#        V 4      w  r VP                  V4       VP*                  Vn        V '       d   V ^ ,          R8w  d&   \        P                  ! RP                  V 4      4      hVP                  \        RR4      4       V R,          p Vez   \1        4       p
V '       de   V ^ ,          \2        9   d   \5        V 4      w  r M1V ^ ,          R8X  d   \        RR4      pV R,          p M\7        V 4      w  r V
P                  V4       Kl  T
pM\)        V 4      w  r VP                  V4       Ve   Tp W3#   \        P                   d     EL)i ; i    EL; i)r   r  z)Parameter contains name ({}) but no valuer  TzIncomplete parameterzextended-parameter-markerrv  =zParameter not followed by '='parameter-separatorNr   F'z5Quoted string value for extended parameter is invalidr   r  zZParameter 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 delimitersr  r  z=Expected RFC2231 char/lang encoding delimiter, but found {!r}zRFC2231-delimiterz;Expected RFC2231 char/lang encoding delimiter, but found {}DQUOTE)r  r  r   r!   r   r  r:   r  r  r:  r  r  ra  rb  re  r   r  r  r  rl   r  r   r   r   r  r?  r5  rU  )r   r  rW   r,  appendtoqstringinner_value
semi_validrC  tr  s   &          r   get_parameterr  	  s    KE 'LE	LLE!HOV77 9%%+VE]4 	5|Qx3	&u-LE"EOLL ))*@AA8s?LLs,GHI"IE!ENQx3%%&EFF	LLs$9:;"IEq[(UIH~~~%%E!HO /u5,,
1${1~4!
*;7DGsN!%J&3K@ !%JMM  !;!;G"I JLL!<<#77AaD H	 
  EIMM  !;!;:"; < qS '>>>U11A5aCOOE"$!<V77DE 	F V7768 	9<  <<#66  LLJ&OOAGGEM8s?)) +FFLfUmU Uc+>?@b	U1X_'.LEOOE"EJE!HO-- /<<BF5MK Kc+>?@b	GQx3&u~uqS%c84b	+E2HHUO 'OOE<i && 		Ds   %W &W! WW!W&c                     \        4       pV '       d    \        V 4      w  r VP                  V4       V '       d{   V ^ ,          R8w  dm   VR	,          pRVn        \        V 4      w  r VP                  V4       VP                  P                  \        P                  ! RP                  V4      4      4       V '       g   K  VP                  \        RR4      4       V R,          p K  V#   \        P                   Ed    R pT ^ ,          \
        9   d   \        T 4      w  r0T '       g   TP                  T4       Tu # T ^ ,          R8X  dH   Te   TP                  T4       TP                  P                  \        P                  ! R4      4        EL]\        T 4      w  r T'       d   T.TR&   TP                  T4       TP                  P                  \        P                  ! RP                  T4      4      4        ELi ; i)
Nr  zparameter entry with no contentrp  zinvalid parameter {!r}r  z)parameter with invalid trailing text {!r}r  rv  r  )r  r  r   r   r:  ra  rb  r!   r  r  r:   rl   rU   r  )r   mime_parametersrW   rr  r  s   &    r   parse_mime_parametersr  
  s    %&O
	=(/LE""5)( U1X_ $B'E2E07LELL##**6+E+E;BB5I,K L5""=6K#LM"IEA && 	=FQx;& (&&v.&&Qx3%#**62''..v/I/I507 8  5U;!'E"I&&u-''..v/I/I,33E:0< =#	=s%   C& &>G=%G=:AG=A*G=<G=c                 |   V'       dn   V^ ,          R8w  d`   V^ ,          \         9   d.   V P                  \        V^ ,          R4      4       VR,          pKU  \        V4      w  r!V P                  V4       Ku  V'       g   R# V P                  \        RR4      4       V P                  \	        VR,          4      4       R# )r   r  r  rv  Nr  )ru  r   r  rw  r  )	tokenlistr   rW   s   && r   _find_mime_parametersr  M
  s     E!HO8{"]585HIJ"IE%e,LEU#]3(=>?*5956r   c                    \        4       pV '       g2   VP                  P                  \        P                  ! R 4      4       V#  \        V 4      w  r TP                  T4       T '       d   T ^ ,          R8w  dE   TP                  P                  \        P                  ! R4      4       T '       d   \        Y4       T# TP                  P                  4       P                  4       Tn        TP                  \        RR4      4       T R,          p  \        T 4      w  r TP                  T4       TP                  P                  4       P                  4       Tn        T '       g   T# T ^ ,          R8w  dP   TP                  P                  \        P                  ! RP                  T 4      4      4       T=T=\        Y4       T# TP                  \        RR	4      4       TP                  \!        T R,          4      4       T#   \        P                   dO    TP                  P                  \        P                  ! RP                  T 4      4      4       \        Y4       Tu # i ; i  \        P                   dO    TP                  P                  \        P                  ! RP                  T 4      4      4       \        Y4       Tu # i ; i)
z"Missing content type specificationz(Expected content maintype but found {!r}r  zInvalid content typezcontent-type-separatorrv  z'Expected content subtype but found {!r}r  z<Only parameters are valid after content type, but found {!r}r  )r  r!   r   r   r  r  r:  r  r:   r  r   r  lowerr  r  r  r  )r   ctyperW   s   &  r   parse_content_type_headerr  ]
  s8    MEV>>02 	3 ' 
LL E!HOV77"$ 	%!%/[[&&(..0EN	LLs$<=>"IE ' 
LLKK%%'--/EMQx3V77( 	) NEMe+	LLs$9:;	LL&uRy12LQ "" V776==eDF 	Ge+	& "" V775<<UCE 	Fe+	s&   G? I% ?A I"!I"%A KKc                 .   \        4       pV '       g2   VP                  P                  \        P                  ! R 4      4       V#  \        V 4      w  r TP                  T4       TP                  P                  4       P                  4       Tn        T '       g   T# T ^ ,          R8w  dL   TP                  P                  \        P                  ! RP                  T 4      4      4       \        Y4       T# TP                  \        RR4      4       TP                  \        T R,          4      4       T#   \        P                   dO    TP                  P                  \        P                  ! RP                  T 4      4      4       \        Y4       Tu # i ; i)zMissing content dispositionz+Expected content disposition but found {!r}r  zCOnly parameters are valid after content disposition, but found {!r}r  rv  )r  r!   r   r   r  r  r:  r  r:   r  r   r  r  r  r  r  )r   disp_headerrW   s   &  r    parse_content_disposition_headerr  
  sU    %&K""6#D#D)$+ 	, ' u&+kk&7&7&9&?&?&AK#Qx3""6#=#=$( 	) 	k1}S*?@A,U2Y78# "" ""6#=#=9@@G$I 	Jk1	s   D1 1A FFc                    \        4       pV '       g2   VP                  P                  \        P                  ! R 4      4       V#  \        V 4      w  r VP                  V4       VP                  P                  4       P                  4       Vn	        V '       g   V# V '       d   VP                  P                  \        P                  ! R4      4       V ^ ,          \        9   d.   VP                  \        V ^ ,          R4      4       V R,          p Kv  \        V 4      w  r VP                  V4       K  V#   \        P                   dB    TP                  P                  \        P                  ! RP                  T 4      4      4        Li ; i)z!Missing content transfer encodingz1Expected content transfer encoding but found {!r}z*Extra text after content transfer encodingr  rv  )r  r!   r   r   r  r  r   r  r  r   r:  r  r:   ru  r  rw  )r   
cte_headerrW   s   &  r   &parse_content_transfer_encoding_headerr  
  s@   
 )*J!!&"C"C/#1 	25 '
 	% **,224

!!&"<"<8#: 	;8{"mE!H6IJK"IE%e,LEe$# "" P!!&"<"<?FFuM#O 	PPs   D2 2AFFc                     R pV '       dH   V R,          '       d9   V R,          R,          \         9   d    V R,          R,          pV R,          RR V R&   V# )r(   Nr  )r?  )lineswsps   & r   _steal_trailing_WSP_if_existsr  
  sF    
CruRy}3Bim"IcrNb	Jr   c          	      T
   VP                   ;'       g    \        P                  pVP                  '       d   R MRpR.pRpRpRp^ pRp	\	        RR4      p
\        V 4      pV'       Ed+   VP                  ^ 4      pWJ d   V^,          pK*  \        V4      pV	'       gG   VP                  R9   d   \        P                  V4      '       * p	M\        P                  V4      '       * p	 VP                  V4       TpVP                  R
8X  d   \!        WW#4       K  V	'       EdH   V'       Eg?   VP"                  '       g   Rp	RpVP$                  '       d   VP'                  VR7      R\)        VP*                  4      )  pVP*                  V9  d\   \)        V4      V\)        VR,          4      ,
          8  d   \-        V4      pVP/                  V4       VR;;,          V,          uu&   EK  \1        VR4      '       g   \        V4      V,           pRp	EK  VP"                  '       dC   Ve   W8w  d   VR	8X  g   VR 8X  d
   VR8w  d   Rp\3        WW&VP4                  W4      pRpTpRp	EK  RpRp	\)        V4      V\)        VR,          4      ,
          8:  d   VR;;,          V,          uu&   EKE  RpVP$                  '       d   \)        V4      ^,           V8:  d   \-        V4      pV'       g   VP7                  4       '       d_   VP/                  VV,           4       . pVR,           F!  pV\8        9  d    MVP/                  V4       K#  	  RP;                  V4      pRpEK  \1        VR4      '       g   \        V4      pVP                  R8X  dJ   \=        RR4      .V Uu. uF  p\=        \?        V4      R4      NK  	  up,           \=        RR4      .,           pVP"                  '       g   V^,          pVP/                  V
4       VV,           pEK  VP"                  '       d    V'       g   VPA                  ^ V4       Rp	EK  \-        V4      pV'       g   VP7                  4       '       d   VP/                  VV,           4       EK  VR;;,          V,          uu&   EK3  VP*                  P;                  V4      VP*                  ,           #   \         dZ    \        ;QJ d&    R TP                   4       F  '       g   K   RM	  RM! R TP                   4       4      '       d   R	pMR pRp	 EL+i ; iu upi )utf-8r  r(   NFwrap_as_ew_blockedr  c              3   V   "   T F  p\        V\        P                  4      x  K!  	  R # 5ir   )rx  r   r  r+   s   & r   r.   %_refold_parse_tree.<locals>.<genexpr>  s'      .,q a!>!>??,r  Tunknown-8bitr  rZ   r|  r   r   )r  rE  r  )!max_line_lengthsysmaxsizeutf8r  r  rw  r   rl   
SPECIALSNL
isdisjointNLSETr|  r  r  rE   _fold_mime_parametersrO   rt   r^   r  r  r  r   rm   _fold_as_ewru   rK   r?  r3   r  r   insert)
parse_treer[   maxlenr  r	  leading_whitespacelast_ewlast_charsetr  want_encodingend_ew_not_allowedr  rP   tstrr   encoded_partnewlinewhitespace_accumulatorcharnewpartsps   &$                   r   r\   r\   
  s   
 ##22s{{F +++w:HDE GLM!"&:;E
%yy|%!#4y"44$.$9$9$$? ? %*$4$4T$: :	!KK!G ??//!$v@=!3!3%%% %'''#'99F9#;<Qc&..>Q=Q#RL~~\9|,vE"I/FF&CE&JG!LL1b	\1	 
 4**T
U* %### '+!^3!W,J1F"G%d6&*&=&=w\ &("& %  % t9U2Y//"II
     D	A'3E:G$--//
 Wt^,)+&!"IID3*11$7 & &(WW-C%D"tX&&DzH"66
 #301&(& ##4Q#7A&(( #3012 
 %%%"a'" 23u$E&8 LLD! M/6d))++LL4( "II>>u%66o " 	!s . ,,.sss . ,,. . .( " M	!B(s*   #R> T%>T"T"2$T"T"!T"c                 h   Ve>   V'       d6   \        \        VR,          VR  V ,           4      4      p VR,          R V VR&   MjV ^ ,          \        9   dY   V ^ ,          pV R,          p \        VR,          4      V8X  d   VP	                  \        V4      4       VR;;,          V,          uu&   RpV R,          \        9   d   V R,          pV R R p Vf   \        VR,          4      MTp	VR8X  d   RMTp
\        V
4      ^,           pV^,           V8  d   \        P                  ! R4      hV '       Edd   V\        VR,          4      ,
          pW,
          \        V4      ,
          pV^ 8:  d   VP	                  R4       KT  \        V4      ^8  dN   \        VR,          4      ^8X  d7   V'       d/   \        P                  ! WjR7      pVR;;,          V,          uu&   RpV R V p\        P                  ! WR7      p\        V4      V,
          pV^ 8  d1   VR R p\        P                  ! WR7      p\        V4      V,
          pK7  VR;;,          V,          uu&   V \        V4      R  p RpV '       g   EKF  VP	                  R4       \        VR,          4      p	EKl  VR;;,          V,          uu&   V'       d   V	# R # )	Nrv  r(   r  r  z3max_line_length is too small to fit an encoded wordr   )r   r  )
r   rO  r?  r  r   r  r   r:  r<  r|  )	to_encoder	  r  r  ru   r   r  leading_wsptrailing_wspnew_last_ew	encode_as
chrome_lenremaining_space
text_spaceencoded_wordto_encode_wordexcesss   &&&&&&&          r   r  r    sK    1U2Ywx09<=?	"Ihw'b		1	  lbM	b	Nf$LL6u=>b	[ 	L} }crN	$+O#eBi.K"j0gI Y!#JQ6!%%AC 	C ) 3uRy>1$1C8J4KK
?LL u:>c%)n16H::&8LL"I%I!#";J/zz.D\"_4qj ,CR0N::nHL&8Fb	\!	c.123	9LLeBi.K	"II,;6$6r   c           	         V P                    EF6  w  rEVR,          P                  4       P                  R4      '       g   VR;;,          R,          uu&   TpRp VP                  V4       RpV'       d6   \        P                  P                  VRVR	7      p	R
P                  WFV	4      p
MRP                  V\        V4      4      p
\        VR,          4      \        V
4      ,           ^,           V8  d   VR,          R,           V
,           VR&   EK  \        V
4      ^,           V8:  d   VP                  RV
,           4       EK4  ^ pVR,           pV'       g   EKJ  \        V4      \        \        V4      4      ,           ^,           \        V4      ,           pW-^,           8:  d   ^NpW-,
          ^,
          ;r VRV p\        P                  P                  VRVR	7      p	\        V	4      V8:  d   MV^,          pKD  VP                  RP                  WKW4      4       RpV^,          pW^R pV'       g   K  VR;;,          R,          uu&   K  	  R#   \         d,    Rp\
        P                  ! T4      '       d   RpRp ELRp ELi ; i)r  r  strictFTr  r  r  r(   )safer   z
{}*={}''{}r  r   z''Nz {}*{}*={}{}r  )r  rg  r  r|  r  r   r  r  r  r   r:   r   r  r   r   )rP   r	  r  r  r  r   r   error_handlerencoding_requiredencoded_valuer#  r  extra_chromer0  
splitpointmaxcharspartials   &&&&             r   r  r    s.    {{ Ry!**3//"II 		"LL" % "LL..B} / 6M&&tmDD>>$U(;<DuRy>CI%)F2b	C$.E"IY]f$LLt$ ~eTSW%66:S=NNJa'
 $*$7!$;;J, & 2 2"] !3 !<}%1a
LL..|< =LqLG+&Eub	S 	u # " 	" $$$U++( 1!	"s   I

(J 3J :J ?J )rE  )rer  r  stringr   operatorr   emailr   r<  r   r   rl  r?  ra  rq  rg  rm  ru  	TSPECIALSr  	ASPECIALSr  r  r  r  r   r   compileVERBOSE	MULTILINErJ  r  r   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r+  r:  r>  rL  rQ  rX  r[  r^  r`  rr  rt  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  rO   rt   r  r:   r3   rT  r(  r.  matchrX  findallr"  r  r  r  r&  r1  r5  rF  rO  rS  rU  rZ  r]  r_  rb  re  rh  rk  rn  rs  rw  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  r  r  r  r\   r  r  r   r   r   <module>rK     s  L 
 
    '   
%jCHn sN	CH$U#E
"c#h.	_
E
"	S(3s83 	t
@
 **  ZZ",, @, @,FD) D I  Y 9 " 9 I 
) #9 #6	-| 	-! 4C) C&%i %2?) ?%	 %"$I $*"y "6	 DDy D!i !6;Y ;.Y .i ) 
I 
y B9 -!& -!`!	 !HI  ) 	 8%y %
#	 #i I S.Y S.ly * 1 i ) 
*I * &y &Y (+s (+V H - <f-- < Cc#34#  % $S*BC . 

:,,RWWS\:;AA

9#3#3IIbggi !$# $$)E 

#56>> I$4$4IIbggj!"%$ %%*U ZZ	(8(8IIbggn%&)( )). &(jj1A1AIIbgg-./21 '227% $;J@
/bAF" ))V2 $6 &2 D$L%N2!h(%!N$L ) V,\"H*"$6r#J<:4n&,BJ8BH$$&.&.$,<,KZ2h7 6p<^Y7vJ7XI!r   