+
    lh>                       R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t^ RI
t^ RIt^ RIt^ RIHt  ^ RIt. R6Ot]P$                  P'                  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	]P8                  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%R7R+ lt&R, t'R- t(R. t)R/ t*R0 t+ ! R1 R],4      t- ! R2 R]-4      t. ! R3 R]-4      t/ ! R4 R]-4      t0 ! R5 R]-4      t1R#   ] d    Rt ELEi ; i)8zDRead/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes.N)GenericAliasMailboxMaildirmboxMHBabylMMDFMessageMaildirMessagemboxMessage	MHMessageBabylMessageMMDFMessageErrorNoSuchMailboxErrorNotEmptyErrorExternalClashErrorFormatErrorasciic                     a  ] tR t^"t o RtR$R ltR tR tR tR t	R t
R%R	 ltR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR%R ltR tR%R ltR tR tR t R t!R  t"R!t#R&R" lt$]%! ]&4      t'R#t(V t)R# )'r   z*A group of messages in a particular place.Nc                    \         P                  P                  \         P                  P                  V4      4      V n        W n        R# )zInitialize a Mailbox instance.N)ospathabspath
expanduser_path_factoryselfr   factorycreates   &&&&lib/python3.14/mailbox.py__init__Mailbox.__init__%   s*    WW__RWW%7%7%=>
    c                    \        R4      h)$Add message and return assigned key.&Method must be implemented by subclassNotImplementedErrorr   messages   &&r!   addMailbox.add*       !"JKKr$   c                    \        R4      h)=Remove the keyed message; raise KeyError if it doesn't exist.r'   r(   r   keys   &&r!   removeMailbox.remove.   r.   r$   c                (    V P                  V4       R # N)r3   r1   s   &&r!   __delitem__Mailbox.__delitem__2   s    Cr$   c                N     V P                  V4       R#   \         d     R# i ; iz'If the keyed message exists, remove it.N)r3   KeyErrorr1   s   &&r!   discardMailbox.discard5   s%    	KK 		s    $$c                    \        R4      h)>Replace the keyed message; raise KeyError if it doesn't exist.r'   r(   r   r2   r+   s   &&&r!   __setitem__Mailbox.__setitem__<   r.   r$   c                L     V P                  V4      #   \         d    Tu # i ; i)z9Return the keyed message, or default if it doesn't exist.)__getitem__r;   )r   r2   defaults   &&&r!   getMailbox.get@   s,    	##C(( 	N	s    ##c                   V P                   '       g   V P                  V4      # \        P                  ! V P	                  V4      4      ;_uu_ 4       pV P                  V4      uuRRR4       #   + '       g   i     R# ; i)z=Return the keyed message; raise KeyError if it doesn't exist.N)r   get_message
contextlibclosingget_file)r   r2   files   && r!   rD   Mailbox.__getitem__G   sS    }}}##C((##DMM#$6774}}T* 8777s   A--A>	c                    \        R4      h)4Return a Message representation or raise a KeyError.r'   r(   r1   s   &&r!   rI   Mailbox.get_messageO   r.   r$   c                h    \         P                  ! V P                  V4      4      P                  4       # )zReturn a string representation or raise a KeyError.

Uses email.message.Message to create a 7bit clean string
representation of the message.emailmessage_from_bytes	get_bytes	as_stringr1   s   &&r!   
get_stringMailbox.get_stringS   s'    
 ''s(;<FFHHr$   c                    \        R4      h)z8Return a byte string representation or raise a KeyError.r'   r(   r1   s   &&r!   rV   Mailbox.get_bytesZ   r.   r$   c                    \        R4      h)6Return a file-like representation or raise a KeyError.r'   r(   r1   s   &&r!   rL   Mailbox.get_file^   r.   r$   c                    \        R4      h)Return an iterator over keys.r'   r(   r   s   &r!   iterkeysMailbox.iterkeysb   r.   r$   c                4    \        V P                  4       4      # )zReturn a list of keys.)listrb   ra   s   &r!   keysMailbox.keysf   s    DMMO$$r$   c              #  z   "   V P                  4        F  p W,          pTx  K  	  R#   \         d     K$  i ; i5i)z%Return an iterator over all messages.Nrb   r;   r   r2   values   &  r!   
itervaluesMailbox.itervaluesj   s;     ==?C	 K #  s   ;)
;8;8;c                "    V P                  4       # r6   )rl   ra   s   &r!   __iter__Mailbox.__iter__s   s      r$   c                4    \        V P                  4       4      # )z,Return a list of messages. Memory intensive.)re   rl   ra   s   &r!   valuesMailbox.valuesv   s    DOO%&&r$   c              #  |   "   V P                  4        F  p W,          pY3x  K  	  R#   \         d     K%  i ; i5i)z.Return an iterator over (key, message) tuples.Nri   rj   s   &  r!   	iteritemsMailbox.iteritemsz   s>     ==?C	 , #  s   <*<9<9<c                4    \        V P                  4       4      # )z9Return a list of (key, message) tuples. Memory intensive.)re   ru   ra   s   &r!   itemsMailbox.items   s    DNN$%%r$   c                    \        R4      h)9Return True if the keyed message exists, False otherwise.r'   r(   r1   s   &&r!   __contains__Mailbox.__contains__   r.   r$   c                    \        R4      h)*Return a count of messages in the mailbox.r'   r(   ra   s   &r!   __len__Mailbox.__len__   r.   r$   c                V    V P                  4        F  pV P                  V4       K  	  R# )zDelete all messages.N)rf   r<   r1   s   & r!   clearMailbox.clear   s    99;CLL r$   c                `     W,          pT P                  T4       T#   \          d    Tu # i ; i)z3Delete the keyed message and return it, or default.)r;   r<   )r   r2   rE   results   &&& r!   popMailbox.pop   s7    	YF 	S  	N	s    --c                j    V P                  4        F  pWP                  V4      3u # 	  \        R4      h)z6Delete an arbitrary (key, message) pair and return it.zNo messages in mailbox)rb   r   r;   r1   s   & r!   popitemMailbox.popitem   s1    ==?C#'' # 344r$   c                   \        VR4      '       d   VP                  4       pM%\        VR4      '       d   VP                  4       pMTpRpV F
  w  rE WPV&   K  	  V'       d   \        R4      hR#   \         d    Rp K3  i ; i)z4Change the messages that correspond to certain keys.ru   rx   FTzNo message with key(s)N)hasattrru   rx   r;   )r   argsourcebad_keyr2   r+   s   &&    r!   updateMailbox.update   s    3$$]]_FS'""YY[FF"LC#S	 #
 344   s   A00B Bc                    \        R4      h)&Write any pending changes to the disk.r'   r(   ra   s   &r!   flushMailbox.flush   r.   r$   c                    \        R4      h)Lock the mailbox.r'   r(   ra   s   &r!   lockMailbox.lock   r.   r$   c                    \        R4      h)#Unlock the mailbox if it is locked.r'   r(   ra   s   &r!   unlockMailbox.unlock   r.   r$   c                    \        R4      h)Flush and close the mailbox.r'   r(   ra   s   &r!   closeMailbox.close   r.   r$   c                Z     VP                  R 4      #   \         d    \        R4      hi ; i)r   z?String input must be ASCII-only; use bytes or a Message instead)encodeUnicodeError
ValueErrorr*   s   &&r!   _string_to_bytesMailbox._string_to_bytes   s7    	2>>'** 	2 1 2 2	2s    *Fc                >   \        V\        P                  P                  4      '       d   \        P
                  ! 4       p\        P                  P                  WC^ 4      pVP                  V4       VP                  ^ 4       VP                  4       pVP                  R\        4      pVP                  V4       V P                  '       d5   VP                  \        4      '       g   VP                  \        4       R# R# R# \        V\         \"        \        P$                  34      '       d   \        V\        P$                  4      '       d-   \&        P(                  ! R\*        ^4       VP-                  4       p\        V\         4      '       d   V P/                  V4      pV'       d   VP                  RR4      pVP                  R\        4      pVP                  V4       V P                  '       d5   VP                  \        4      '       g   VP                  \        4       R# R# R# \1        VR4      '       EdJ   \1        VR4      '       d)   \&        P(                  ! R\*        ^4       VP2                  pRp VP5                  4       pVP                  R	4      '       d   VRR R,           pM#VP                  R
4      '       d   VRR R,           pV'       g   MZV'       d(   VP7                  R4      '       d   RVR,          ,           pVP                  R\        4      pVP                  V4       TpK  V P                  '       d?   V'       d5   VP                  \        4      '       g   VP                  \        4       R# R# R# R# \9        R\;        V4      ,          4      h)z%Dump message contents to target file.   
8Use of StringIO input is deprecated, use BytesIO insteads   
From s   
>From readbufferDUse of text mode files is deprecated, use a binary mode file insteadN   
      From s   >From    NNInvalid message type: %s)
isinstancerT   r+   r	   ioBytesIO	generatorBytesGeneratorflattenseekr   replacelinesepwrite_append_newlineendswithstrbytesStringIOwarningswarnDeprecationWarninggetvaluer   r   r   readline
startswith	TypeErrortype)	r   r+   targetmangle_from_r   gendatalastlinelines	   &&&&     r!   _dump_messageMailbox._dump_message   s    gu}}4455ZZ\F//00qICKK KKN;;=D<<w/DLL###DMM',B,BW% -C# #ubkk!:;;'2;;// *+=qB!**,'3''//8!//*kBooeW5GLL!###G,<,<W,E,EW% -F# Wf%%w)) 56H!M!..H'')==))9u,D]]5))9u,DDOOH$=$=$tBx/D||E73T"###9J9J79S9SW% :T# 6gFGGr$   )r   r   NTr6   F)*__name__
__module____qualname____firstlineno____doc__r"   r,   r3   r7   r<   rA   rF   rD   rI   rX   rV   rL   rb   rf   rl   ro   rr   ru   rx   r|   r   r   r   r   r   r   r   r   r   r   r   r   classmethodr   __class_getitem____static_attributes____classdictcell____classdict__s   @r!   r   r   "   s     4 
LLL+LILLL%!'&LL
55"LLLL2 O4Hl $L1r$   c                     a  ] tR tRt o RtRtR(R ltR tR tR t	R	 t
R
 tR tR tR tV 3R lR ltR tV 3R lR ltV 3R lR ltV 3R lR ltR tR tR tR tR tR tR tR tR tR  tR! tR" t^t R# t!R$ t"R% t#R& t$R't%V t&R# ))r   i  zA qmail-style Maildir mailbox.:Nc           	        \         P                  WW#4       R\        P                  P	                  V P
                  R4      R\        P                  P	                  V P
                  R4      R\        P                  P	                  V P
                  R4      /V n        \        P                  P                  V P
                  4      '       gx   V'       d[   \        P                  ! V P
                  R4       V P                  P                  4        F  p\        P                  ! VR4       K  	  M\        V P
                  4      h/ V n        R^ R^ /V n        ^ V n        RV n        R# )zInitialize a Maildir instance.tmpnewcur  g?N)r   r"   r   r   joinr   _pathsexistsmkdirrr   r   _toc_toc_mtimes
_last_read_skewfactor)r   dirnamer   r    r   s   &&&& r!   r"   Maildir.__init__  s    8277<<

E2277<<

E2277<<

E2
 ww~~djj))U+ KK..0DHHT5) 1 )44	!1eQ/r$   c                .   V P                  4       p V P                  W4       \        T4       \        T\        4      '       dE   TP                  4       pT P                  TP                  4       ,           pY@P                  8X  d   RpMRpRp\        P                  P                  TP                  4      P                  T P                  4      ^ ,          p\        P                  P!                  T P"                  Y5T,           4      p\        T\        4      '       dY   \        P$                  ! TP                  \        P                  P'                  TP                  4      TP)                  4       34         \        P*                  ! TP                  T4       \        P
                  ! TP                  4       T#   \         d3    TP                  4        \        P
                  ! TP                  4       h i ; i  \,        \.        3 d&    \        P0                  ! TP                  T4        T# i ; i  \2         dX   p\        P
                  ! TP                  4       TP4                  \4        P6                  8X  d   \9        RT,          4      hh Rp?ii ; i)r&    r   z$Name clash with existing message: %sN)_create_tmpr   BaseExceptionr   r   r3   name_sync_closer   r
   
get_subdircolonget_infor   basenamesplitr   r   utimegetatimeget_datelinkAttributeErrorPermissionErrorrenameOSErrorerrnoEEXISTr   )r   r+   tmp_filesubdirsuffixuniqdestes   &&      r!   r,   Maildir.add$  s   ##%	w1
 	Hg~..'')FZZ'"2"2"44F#FFww.44TZZ@Cww||DJJv>g~..HHX]]gg&&x}}5w7G7G7IJL
	)t, 		(--( G  	NNIIhmm$	0 #O4 /		(--. /  	IIhmm$ww%,,&()O+/*0 1 1 	sB   F9 6!G9  H2 9=G692H/+H2 .H//H2 2J=AJJc                    \         P                  ! \         P                  P                  V P                  V P                  V4      4      4       R# r0   N)r   r3   r   r   r   _lookupr1   s   &&r!   r3   Maildir.removeN  s*    
		"'',,tzz4<<+<=>r$   c                Z     V P                  V4       R#   \        \        3 d     R# i ; ir:   )r3   r;   FileNotFoundErrorr1   s   &&r!   r<   Maildir.discardR  s+    	KK+, 		s    **c                &   V P                  V4      pV P                  V4      pV P                  V4      p\        V\        4      '       d   TpMTp\        P
                  P                  V4      pV P                  V9   d5   V P                  VP                  V P                  4      R,          ,           pMRpV P                  V4       \        P
                  P                  V P                  V4      p	\        P
                  P                  V P                  WqV,           4      p
\        V\        4      '       dE   \        P                  ! V	\        P
                  P                  V	4      VP                  4       34       \        P                  ! W4       R# )r?   r   Nr   )r  r,   r   r
   r   r   r   r   r   r<   r   r   r   r   r  r  )r   r2   r+   old_subpathtemp_keytemp_subpathdominant_subpathr
  r  tmp_pathnew_paths   &&&        r!   rA   Maildir.__setitem__Z  s   ll3'88G$||H-g~..+  +!12::))ZZ"2"8"8"DR"HHFFS77<<

L977<<

F&LAg~..HHXgg&&x0'2B2B2DEG
 			(%r$   c                   V P                  V4      p\        \        P                  P	                  V P
                  V4      R4      ;_uu_ 4       pV P                  '       d   V P                  V4      pM\        V4      pRRR4       \        P                  P                  V4      w  rVXP                  V4       V P                  V9   d2   VP                  VP                  V P                  4      R,          4       VP                  \        P                  P                  \        P                  P	                  V P
                  V4      4      4       V#   + '       g   i     L; i)rP   rbNr   )r  openr   r   r   r   r   r
   r   
set_subdirr   set_infoset_dategetmtime)r   r2   subpathfmsgr
  r   s   &&     r!   rI   Maildir.get_messageu  s    ,,s#"'',,tzz73T::a}}}mmA&$Q'	 ;
 ww}}W-v::LLDJJ/34RWW%%bggll4::w&GHI
 ;:s   0EE"	c                   \        \        P                  P                  V P                  V P                  V4      4      R4      ;_uu_ 4       pVP                  4       P                  \        R4      uuRRR4       #   + '       g   i     R# ; i)2Return a bytes representation or raise a KeyError.r   r   N)	r!  r   r   r   r   r  r   r   r   r   r2   r'  s   && r!   rV   Maildir.get_bytes  sS    "'',,tzz4<<+<=tDD668##GU3 EDDDs   $A;;B	c                    \        \        P                  P                  V P                  V P                  V4      4      R4      p\        V4      # )r]   r   )r!  r   r   r   r   r  
_ProxyFiler,  s   && r!   rL   Maildir.get_file  s4    djj$,,s*;<dC!}r$   c                    V P                  V4      pV P                  V9   d#   VP                  V P                  4      R,          # R# )z+Get the keyed message's "info" as a string.r   r   )r  r   r   )r   r2   r&  s   && r!   r   Maildir.get_info  s7    ,,s#:: ==,R00r$   c                    < V ^8  d   QhRS[ /# )   infor   )formatr   s   "r!   __annotate__Maildir.__annotate__  s     % %# %r$   c                   \        V\        4      '       g   \        R\        V4       24      hV P	                  V4      pVP                  V P                  4      ^ ,          pV'       d   W@P                  V,           ,          pWC8X  d   R# \        P                  P                  V P                  V4      p\        P                  P                  V P                  V4      p\        P                  ! WV4       W@P                  V&   R# )z&Set the keyed message's "info" string.zinfo must be a string: N)r   r   r   r   r  r   r   r   r   r   r   r  r   )r   r2   r5  r  new_subpathold_pathr  s   &&&    r!   r#  Maildir.set_info  s    $$$5d4j\BCCll3'!''

3A6::,,K%77<<

K877<<

K8
		(%$		#r$   c                h    V P                  V4      pVP                  R4      '       d
   VR,          # R# )zHReturn as a string the standard flags that are set on the keyed message.2,r4  NNr   )r   r   )r   r2   r5  s   && r!   	get_flagsMaildir.get_flags  s+    }}S!??4  8Or$   c                    < V ^8  d   QhRS[ /# )r4  flagsr6  )r7  r   s   "r!   r8  r9    s     ? ?C ?r$   c                    \        V\        4      '       g   \        R\        V4       24      hV P	                  VRRP                  \        \        V4      4      4      ,           4       R# )z>Set the given flags and unset all others on the keyed message.zflags must be a string: r?  r   N)r   r   r   r   r#  r   sortedset)r   r2   rD  s   &&&r!   	set_flagsMaildir.set_flags  sK    %%%6tE{mDEEc4"''&U*<"==>r$   c                    < V ^8  d   QhRS[ /# r4  flagr6  )r7  r   s   "r!   r8  r9    s     K K# Kr$   c           
         \        V\        4      '       g   \        R\        V4       24      hV P	                  VRP                  \        V P                  V4      4      \        V4      ,          4      4       R# )zCSet the given flag(s) without changing others on the keyed message.flag must be a string: r   N)r   r   r   r   rH  r   rG  rA  r   r2   rL  s   &&&r!   add_flagMaildir.add_flag  sT    $$$5d4j\BCCsBGGCs(;$<s4y$HIJr$   c                    < V ^8  d   QhRS[ /# rK  r6  )r7  r   s   "r!   r8  r9    s     O OS Or$   c           
     $   \        V\        4      '       g   \        R\        V4       24      hV P	                  V4      '       dL   V P                  VRP                  \        V P	                  V4      4      \        V4      ,
          4      4       R# R# )zLUnset the given string flag(s) without changing others on the keyed message.rN  r   N)r   r   r   r   rA  rH  r   rG  rO  s   &&&r!   remove_flagMaildir.remove_flag  sh    $$$5d4j\BCC>>#NN3DNN3,?(@3t9(L MN r$   c              #     "   V P                  4        V P                   F  p V P                  V4       Tx  K  	  R#   \         d     K-  i ; i5ir`   N)_refreshr   r  r;   r1   s   & r!   rb   Maildir.iterkeys  sG     99CS! I   s%    A>
AA	AAAc                >    V P                  4        WP                  9   # r{   )rX  r   r1   s   &&r!   r|   Maildir.__contains__  s    iir$   c                L    V P                  4        \        V P                  4      # r   )rX  lenr   ra   s   &r!   r   Maildir.__len__  s    499~r$   c                    R# )"Write any pending changes to disk.N ra   s   &r!   r   Maildir.flush  s     	r$   c                    R# )r   Nrc  ra   s   &r!   r   Maildir.lock      r$   c                    R# )r   Nrc  ra   s   &r!   r   Maildir.unlock  rg  r$   c                    R# r   Nrc  ra   s   &r!   r   Maildir.close  rg  r$   c                j   . p\         P                  ! V P                  4       F  p\        V4      ^8  g   K  V^ ,          R8X  g   K%  \         P                  P                  \         P                  P                  V P                  V4      4      '       g   Kt  VP                  VR,          4       K  	  V# )Return a list of folder names..   NN)r   listdirr   r_  r   isdirr   appendr   r   entrys   &  r!   list_foldersMaildir.list_folders  sp    ZZ

+E5zA~%(c/ww}}RWW\\$**e<==eBi( , r$   c                    \        \        P                  P                  V P                  RV,           4      V P
                  RR7      # )z/Return a Maildir instance for the named folder.ro  Fr   r    )r   r   r   r   r   r   r   folders   &&r!   
get_folderMaildir.get_folder  s2    rww||DJJf=#}}#% 	%r$   c                   \         P                  P                  V P                  RV,           4      p\	        W P
                  R7      p\         P                  P                  VR4      p\         P                  P                  V4      '       gP   \         P                  ! \         P                  ! V\         P                  \         P                  ,          R4      4       V# )z>Create a folder and return a Maildir instance representing it.ro  r   maildirfolder  )r   r   r   r   r   r   r   r   r!  O_CREATO_WRONLY)r   r|  r   r   maildirfolder_paths   &&   r!   
add_folderMaildir.add_folder  s    ww||DJJf5}}5WW\\$@ww~~011HHRWW/bkk1I r$   c                *   \         P                  P                  V P                  RV,           4      p\         P                  ! \         P                  P                  VR4      4      \         P                  ! \         P                  P                  VR4      4      ,            F3  p\        V4      ^8  g   V^ ,          R8w  g   K#  \        RV,          4      h	  \         P                  ! V4       Fs  pVR8w  g   K  VR8w  g   K  VR8w  g   K  \         P                  P                  \         P                  P                  W#4      4      '       g   Kb  \        RV: RV: 24      h	  \         P                  ! VRR	7       F~  w  rEpV F6  p\         P                  ! \         P                  P                  WC4      4       K8  	  V F6  p\         P                  ! \         P                  P                  WC4      4       K8  	  K  	  \         P                  ! V4       R
# )-Delete the named folder, which must be empty.ro  r   r   zFolder contains message(s): %sr   zFolder contains subdirectory 'z': F)topdownN)r   r   r   r   rr  r_  r   rs  walkr3   rmdir)r   r|  r   rv  rootdirsfiless   &&     r!   remove_folderMaildir.remove_folder  sY   ww||DJJf5ZZT5 9:ZZT5 9:; ;E5zA~qS#$Dv$MNN; ZZ%E~%5.Ue^ww}}RWW\\$677#%+U%4 5 5 &
 "$u!=D		"'',,t34 d23  ">
 	r$   c                   \         P                   ! 4       p\        P                  ! \        P                  P	                  V P
                  R4      4       Fq  p\        P                  P	                  V P
                  RV4      pV\        P                  P                  V4      ,
          R8  g   K[  \        P                  ! V4       Ks  	  R# )zDelete old files in "tmp".r   i@ N)timer   rr  r   r   r   r   r3   )r   nowrv  r   s   &   r!   cleanMaildir.clean  su    iikZZTZZ ?@E77<<

E59DRWW%%d++f4		$ Ar$   c           	        \         P                   ! 4       p\        P                  ! 4       pRV9   d   VP                  RR4      pRV9   d   VP                  RR4      p\	        V4      : R\	        V^,          R,          4      : R\
        P                  ! 4       : R\        P                  : R	V: 2	p\
        P                  P                  V P                  R
V4      p \
        P                  ! V4       \!        RT,          4      h  \         d?    \        ;P                  ^,          un         \        T4      u #   \         d      LVi ; ii ; i)z=Create a file in the tmp subdirectory and open and return it./z\057r   z\072z.Mg    .APQro  r   z&Name clash prevented file creation: %s)r  socketgethostnamer   intr   getpidr   _countr   r   r   statr  _create_carefullyFileExistsErrorr   )r   r  hostnamer  r   s   &    r!   r   Maildir._create_tmp  s    iik%%'(?''W5H(?''W5H$'Hc#'C-.@"))+$+NNH>ww||DJJt4	GGDM !!I!%"& ' 	' ! 	NNaN(.." 		s0   D (E0
D=:E=EEEEc                   \         P                   ! 4       V P                  ,
          ^V P                  ,           8  dw   RpV P                   FZ  p\        P
                  P                  V P                  V,          4      pW0P                  V,          8  d   RpW0P                  V&   K\  	  V'       g   R# / V n        V P                   F  pV P                  V,          p\        P                  ! V4       F  pVP                  R4      '       d   K  \        P
                  P                  WE4      p\        P
                  P                  V4      '       d   Kb  VP                  V P                  4      ^ ,          p\        P
                  P                  W%4      V P                  V&   K  	  K  	  \         P                   ! 4       V n        R# )z!Update table of contents mapping.FTNro  )r  r   r   r   r   r   r%  r   r   rr  r   r   rs  r   r   )r   refreshr
  mtimer   rv  pr  s   &       r!   rX  Maildir._refresh4  s8    99;(1t/?/?+??G**((V)<=++F33"G+0  (	 +
 	&&F;;v&DD)##C((GGLL-77==##{{4::.q1"$'',,v"=		$ * ' ))+r$   c                    \         P                  P                  \         P                  P                  V P                  V P
                  V,          4      4      '       d   V P
                  V,          #  V P                  4         V P
                  V,          #   \         d     L1i ; i  \         d    \        RT,          4      Rhi ; i)z=Use TOC to return subpath for given key, or raise a KeyError.No message with key: %sN)r   r   r   r   r   r   r;   rX  r1   s   &&r!   r  Maildir._lookupZ  s    	ww~~bggll4::tyy~FGGyy~% H 		F99S>!	  		
  	F4s:;E	Fs$   AB  B B) B&%B&)Cc                    \        V R4      '       g   V P                  4       V n          V \        V P                  4      ,          #   \         d     R# \
         d     K9  i ; i)z0Return the next message in a one-time iteration._onetime_keysN)r   rb   r  nextStopIterationr;   ra   s   &r!   r  Maildir.nexth  sX    t_--!%DD!3!3455   s   A A"A"A"!A")r   r  r   r   r   r   r   )'r   r   r   r   r   r   r"   r,   r3   r<   rA   rI   rV   rL   r   r#  rA  rH  rP  rT  rb   r|   r   r   r   r   r   rw  r}  r  r  r  r  r   rX  r  r  r   r   r   s   @r!   r   r     s     (E((T?&64

% %? ?K KO O 

%&  F'0$&LF
 
r$   c                      a  ] tR tRt o RtRR ltR tR tR tR t	R	 t
R
 tR tR tR tR tR tR tR tRR ltR tRtV tR# )_singlefileMailboxiu  zA single-file mailbox.Nc                *   \         P                  WW#4        \        V P                  R4      pY@n
        RT n        ^ T n        RT n        RT n        RT n        RT n        R#   \         d   pTP
                  \
        P                  8X  d9   T'       d   \        T P                  R4      p Rp?L\        T P                  4      hTP
                  \
        P                  \
        P                  39   d   \        T P                  R4      p Rp?Lh Rp?ii ; i)z!Initialize a single-file mailbox.rb+zwb+r   NF)r   r"   r!  r   r  r  ENOENTr   EACCESEROFS_filer   	_next_key_pending_pending_sync_locked_file_length)r   r   r   r    r'  r  s   &&&&  r!   r"   _singlefileMailbox.__init__x  s    W5	TZZ'A 
	" !  		ww%,,&TZZ/A,TZZ88U\\5;;77T*		s*   A   D+&DD-ADDDc                    V P                  4        V P                  V4      V P                  V P                  &   V ;P                  ^,          un        RV n        V P                  ^,
          # )r&   T)r  _append_messager   r  r  r*   s   &&r!   r,   _singlefileMailbox.add  sO    $($8$8$A		$..!! "~~!!r$   c                P    V P                  V4       V P                  V RV n        R# )r0   TN)r  r   r  r1   s   &&r!   r3   _singlefileMailbox.remove  s     SIIcNr$   c                r    V P                  V4       V P                  V4      V P                  V&   RV n        R# )r?   TN)r  r  r   r  r@   s   &&&r!   rA   _singlefileMailbox.__setitem__  s-    S--g6		#r$   c              #  v   "   V P                  4        V P                  P                  4        Rj  xL
  R#  L5irW  )r  r   rf   ra   s   &r!   rb   _singlefileMailbox.iterkeys  s"     99>>###s   .979c                >    V P                  4        WP                  9   # r[  )r  r   r1   s   &&r!   r|   _singlefileMailbox.__contains__  s    iir$   c                L    V P                  4        \        V P                  4      # r^  )r  r_  r   ra   s   &r!   r   _singlefileMailbox.__len__  s    499~r$   c                f    V P                   '       g   \        V P                  4       RV n         R# R# )r   TN)r  
_lock_filer  ra   s   &r!   r   _singlefileMailbox.lock  s#    |||tzz"DL r$   c                f    V P                   '       d   \        V P                  4       RV n         R# R# r   FN)r  _unlock_filer  ra   s   &r!   r   _singlefileMailbox.unlock  s#    <<<$ DL r$   c           	        V P                   '       g1   V P                  '       d   \        V P                  4       RV n        R# V P                  f   Q hV P                  P                  ^ ^4       V P                  P                  4       pWP                  8w  d   \        RV P                  V3,          4      h\        V P                  4      p / pV P                  V4       \        V P                  P                  4       4       F  pV P                  V,          w  rVV P                  P                  V4       V P                  V4       VP                  4       p V P                  P                  \!        RW`P                  P                  4       ,
          4      4      pV'       g   MVP#                  V4       K`  WrP                  4       3W4&   V P%                  V4       K  	  VP                  4       V n        \/        T4       T P                  P'                  4        \(        P0                  ! T P                  4      p	\(        P2                  ! TP,                  T	P4                  4        \(        P6                  ! TP,                  T	P8                  T	P:                  4        \(        P@                  ! TP,                  T P                  4       \E        T P                  R4      T n        Y0n        RT n         RT n        T PF                  '       d   \I        T P                  RR7       R# R#    TP'                  4        \(        P*                  ! TP,                  4       h ; i  \<        \>        3 d     Li ; i  \B         dP    \(        P*                  ! T P                  4       \(        P@                  ! TP,                  T P                  4        ELi ; i)rb  FNz4Size of mailbox file changed (expected %i, found %i)   r  )dotlock)%r  r  _sync_flushr  r   r   tellr  r   _create_temporaryr   _pre_mailbox_hookrF  rf   _pre_message_hookr   minr   _post_message_hookr   r   r3   r   r   r  chmodst_modechownst_uidst_gidr  r  r  r  r!  r  r  )
r   cur_lennew_filenew_tocr2   startstop	new_startr   r5  s
   &         r!   r   _singlefileMailbox.flush  s   }}}!!! DJJ'%*"
 yy$$$ 	

1**//#'''$ &?&*&7&7%A&B C C %TZZ0	G""8,diinn./"iin

&&&x0$MMO	!ZZ__S15

8I1I.K LF!NN6* )==?;''1 0 !)D
 	H

wwtzz"
-	HHX]]DKK=	1IIhmmTZZ0 $**e,
	"<<<tzz51 /	NNIIhmm$ ( 		  	1IIdjj!IIhmmTZZ0	1s2   D'L# %6M +M0 #3MM-,M-0AO
	O
c                    R# ),Called before writing the mailbox to file f.Nrc  r   r'  s   &&r!   r  $_singlefileMailbox._pre_mailbox_hook  rg  r$   c                    R# )-Called before writing each message to file f.Nrc  r  s   &&r!   r  $_singlefileMailbox._pre_message_hook  rg  r$   c                    R# ,Called after writing each message to file f.Nrc  r  s   &&r!   r  %_singlefileMailbox._post_message_hook  rg  r$   c                    V P                  4         V P                  '       d   V P                  4        V P                  P	                  4        R#   T P                  P	                  4        i ; i   T P                  '       d   T P                  4        T P                  P	                  4        i   T P                  P	                  4        i ; i; irk  )r   r  r   r  r   ra   s   &r!   r   _singlefileMailbox.close  s    	#JJL#<<<KKM

  "

  "	#<<<KKM

  "

  "s.   A0 "A A-0C2"B/C/CCc                    V P                   f   V P                  4        Ve    V P                   V,          # R#   \         d    \        RT,          4      Rhi ; i)z'Return (start, stop) or raise KeyError.Nr  )r   _generate_tocr;   r1   s   &&r!   r  _singlefileMailbox._lookup  s\    99 ?Jyy~%   J83>?TIJs	   9 Ac                X   V P                   P                  ^ ^4       V P                   P                  4       p\        V P                  4      ^ 8X  d.   V P
                  '       g   V P                  V P                   4        V P                  V P                   4       V P                  V4      pV P                  V P                   4       T P                   P                  4        T P                   P                  4       T n        T#   \         d    T P                   P                  T4       h i ; i)z;Append message to mailbox and return (start, stop) offsets.)r  r   r  r_  r   r  r  r  _install_messager  r   truncater   r  )r   r+   beforeoffsetss   &&  r!   r  "_singlefileMailbox._append_message%  s    

1"tyy>Qt}}}
 ""4::.	""4::.++G4G##DJJ/ 	

 JJOO-  	JJ'	s   ?AD (D))r  r  r  r  r  r  r   r   r6   )r   r   r   r   r   r"   r,   r3   rA   rb   r|   r   r   r   r   r  r  r  r   r  r  r   r   r   s   @r!   r  r  u  s`      !."$
 

 !B2H	#J r$   r  c                   R   a  ] tR tRt o RtRtR tRR ltRR ltRR lt	R t
R	tV tR
# )	_mboxMMDFi<  zAn mbox or MMDF mailbox.Tc                   V P                  V4      w  r#V P                  P                  V4       V P                  P                  4       P	                  \
        R4      P                  R4      pV P                  P                  W0P                  P                  4       ,
          4      pV P                  VP	                  \
        R4      4      pVP                  V4       VP                  VR,          4       V# )rP   r$   r   r   r   )r  r  r   r   r   r   decoder   r  _message_factoryset_unixfromset_from)r   r2   r  r  	from_linestringr(  s   &&     r!   rI   _mboxMMDF.get_messageA  s    ll3'

JJ'')11'3?FFwO	

(9!9:##FNN7E$BC#Yr]#
r$   c                l    \         P                  ! V P                  W4      4      P                  VR7      # )3Return a string representation or raise a KeyError.)unixfromrS   )r   r2   from_s   &&&r!   rX   _mboxMMDF.get_stringL  s.    ''NN3&((1	5	(A	Br$   c                @   V P                  V4      w  r4V P                  P                  V4       V'       g   V P                  P                  4        V P                  P	                  W@P                  P                  4       ,
          4      pVP                  \        R4      # )r  r   )r  r  r   r   r   r  r   r   )r   r2   r  r  r  r  s   &&&   r!   rV   _mboxMMDF.get_bytesQ  sf    ll3'

JJ!

(9!9:~~gu--r$   c                    V P                  V4      w  r4V P                  P                  V4       V'       g   V P                  P                  4        \	        V P                  V P                  P                  4       V4      # )r]   )r  r  r   r   _PartialFiler  )r   r2   r  r  r  s   &&&  r!   rL   _mboxMMDF.get_fileZ  sS    ll3'

JJ!DJJ

(94@@r$   c                   Rp\        V\        4      '       d   V P                  V4      p\        V\        4      '       dF   VP	                  R4      '       d/   VP                  R4      pVR8w  d   VRV pW^,           R pMTpRpM\        V\        4      '       d*   VP                  4       P                  R4      pRV,           pMO\        V\        P                  P                  4      '       d&   VP                  4       pVe   VP                  R4      pVf?   R\        P                  ! \        P                  ! 4       4      P                  4       ,           pV P                   P#                  4       pV P                   P%                  V\&        ,           4       V P)                  WP                   V P*                  4       V P                   P#                  4       pWV3# )z1Format a message and blindly write to self._file.Nr   r   r$   r   s   From MAILER-DAEMON r   )r   r   r   r   r   find_mboxMMDFMessageget_fromr   rT   r+   r	   get_unixfromr  asctimegmtimer  r  r   r   r   _mangle_from_)r   r+   r  newlineauthorr  r  s   &&     r!   r  _mboxMMDF._install_messageb  sg   	gs##++G4Ggu%%'*<*<X*F*Fll5)G"}#HW-	!A+,/#	!122%%'..w7F 6)I!6!677,,.I$%,,W5	.dkkm1L1S1S1UUI

!

W,-7JJ0B0BCzz }r$   rc  Nr   )r   r   r   r   r   r  rI   rX   rV   rL   r  r   r   r   s   @r!   r  r  <  s-     "M	B
.A r$   r  c                   B   a  ] tR tRt o RtRtRtR	R ltR tR t	Rt
V tR# )
r   i  zA classic mbox mailbox.TNc                H    \         V n        \        P                  WW#4       R# )zInitialize an mbox mailbox.N)r   r  r  r"   r   s   &&&&r!   r"   mbox.__init__       +4w7r$   c                0    VP                  \        4       R# r  r   r   r  s   &&r!   r  mbox._post_message_hook  s    	r$   c                (   . . r!RpV P                   P                  ^ 4        V P                   P                  4       pV P                   P                  4       pVP	                  R4      '       dn   \        V4      \        V4      8  d@   V'       d'   VP                  V\        \        4      ,
          4       MVP                  V4       VP                  V4       RpK  V'       gA   V'       d'   VP                  V\        \        4      ,
          4       MVP                  V4       MV\        8X  d   RpEK  RpEK  \        \        \        W4      4      4      V n        \        V P                  4      V n        V P                   P                  4       V n        R# )0Generate key-to-(start, stop) table of contents.FTr   N)r  r   r  r   r   r_  rt  r   dict	enumeratezipr   r  r  )r   startsstopslast_was_emptyline_posr   s   &     r!   r  mbox._generate_toc  s   B

zz(H::&&(Dx((u:F+%XG%<=
 X.h'!&!LLCL!89LL*!%!&3v#567	TYY JJOO-r$   r  r  r  r   r   )r   r   r   r   r   r  r   r"   r  r  r   r   r   s   @r!   r   r     s(     !M O8
. .r$   c                   @   a  ] tR tRt o RtR	R ltR tR tR tRt	V t
R# )
r   i  zAn MMDF mailbox.Nc                H    \         V n        \        P                  WW#4       R# )zInitialize an MMDF mailbox.N)r   r  r  r"   r   s   &&&&r!   r"   MMDF.__init__  r"  r$   c                >    VP                  R\        ,           4       R# )r     Nr$  r  s   &&r!   r  MMDF._pre_message_hook  s    	#g-.r$   c                T    VP                  \        R,           \        ,           4       R# )r  r5  Nr$  r  s   &&r!   r  MMDF._post_message_hook  s    	--78r$   c                :   . . r!V P                   P                  ^ 4       ^ p TpV P                   P                  4       pV P                   P                  4       pVP	                  R\
        ,           4      '       d   VP                  V4        TpV P                   P                  4       pV P                   P                  4       pVR\
        ,           8X  d(   VP                  V\        \
        4      ,
          4       K  V'       d   Kz  VP                  V4       K  V'       d   EK   \        \        \        Y4      4      4      T n        \        T P                  4      T n        T P                   P                  ^ ^4       T P                   P                  4       T n        R# )r'  r5  N)r  r   r   r  r   r   rt  r_  r(  r)  r*  r   r  r  )r   r+  r,  next_posr.  r   s   &     r!   r  MMDF._generate_toc  s   B

H::&&(Dzz(H2W<==h''H::..0D#zz0H2W<<XG%<=!TX.T3v#567	TYY

1 JJOO-r$   r0  r   )r   r   r   r   r   r"   r  r  r  r   r   r   s   @r!   r   r     s!     8
/9. .r$   c                      a  ] tR tRt o RtRR ltR tR tR tR t	R	 t
R
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )r   i  zAn MH mailbox.Nc                4   \         P                  WW#4       \        P                  P	                  V P
                  4      '       g   V'       d   \        P                  ! V P
                  R4       \        P                  ! \        P                  ! \        P                  P                  V P
                  R4      \        P                  \        P                  ,          \        P                  ,          R4      4       M\        V P
                  4      hRV n        R# )zInitialize an MH instance.r   .mh_sequencesi  FN)r   r"   r   r   r   r   r   r   r!  r   r  O_EXCLr  r   r  r   s   &&&&r!   r"   MH.__init__  s    W5ww~~djj))U+djj/!J!#bii!7"++!EuN O )44r$   c                   V P                  4       p\        V4      ^ 8X  d   ^pM\        V4      ^,           p\        P                  P                  V P                  \        V4      4      p\        V4      pRp V P                  '       d   \        V4         V P                  W4       \!        T\"        4      '       d   T P%                  Y4       T P                  '       d   \        T4       T'       g   \        T4       T#   \         dC    T P                  '       d   \        T4       \        T4       Rp\        P                  ! T4       h i ; i  T P                  '       d   \        T4       i i ; i  T'       g   \        T4       i i ; i)r&   FT)rf   r_  maxr   r   r   r   r   r  r  r  r   r   r  r   r3   r   r   _dump_sequences)r   r+   rf   new_keyr  r'  closeds   &&     r!   r,   MH.add  s$   yy{t9>G$i!mG77<<

CL9h'	|||1$	&&w2 gy11((:<<< OA! % |||$QN!FIIh' <<< O   A s<   7E3 D  ''E E3  E0EE  E00E3 3F	c                \   \         P                  P                  V P                  \	        V4      4      p \        VR4      pVP                  4        \         P                  ! V4       R#   \         d8   pTP                  \        P                  8X  d   \        RT,          4      hh Rp?ii ; i)r0   r  r  N)r   r   r   r   r   r!  r   r3   r  r  r  r;   )r   r2   r   r'  r  s   &&   r!   r3   	MH.remove  s{    ww||DJJC1		T5!A GGIIIdO  	ww%,,&83>??		s   A) )B+42B&&B+c                   \         P                  P                  V P                  \	        V4      4      p \        VR4      p T P                  '       d   \        T4        \         P                  ! \         P
                  ! T\         P                  \         P                  ,          4      4       T P                  Y$4       \!        T\"        4      '       d   T P%                  Y!4       T P                  '       d   \'        T4       \)        T4       R#   \         d8   pTP                  \        P                  8X  d   \        RT,          4      hh Rp?ii ; i  T P                  '       d   \'        T4       i i ; i  \)        T4       i ; i)r?   r  r  N)r   r   r   r   r   r!  r  r  r  r;   r  r  r   r  O_TRUNCr   r   r   rC  r  r   )r   r2   r+   r   r'  r  s   &&&   r!   rA   MH.__setitem__  s   ww||DJJC1	T5!A	|||1$r{{RZZ'?@A""7.gy11((6<<< ON#  	ww%,,&83>??		 <<< O   NsB   D E8 E8  BE &E8 E2EE E55E8 8Fc                L    V P                   '       d?   \        \        P                  P	                  V P
                  \        V4      4      R4      pM>\        \        P                  P	                  V P
                  \        V4      4      R4      p T;_uu_ 4        V P                   '       d   \        V4        \        V4      pV P                   '       d   \        V4       RRR4       T P                  4       P                  4        F  w  rVY9   g   K  XP!                  T4       K   	  X#   \         d8   pTP                  \        P                  8X  d   \        RT,          4      hh Rp?ii ; i  T P                   '       d   \        T4       i i ; i  + '       g   i     L; i)rP   r  r   r  N)r  r!  r   r   r   r   r   r  r  r  r;   r  r   r  get_sequencesrx   add_sequence)r   r2   r'  r  r(  r   key_lists   &&     r!   rI   MH.get_message7  s    		|||djj#c(;UCdjj#c(;TB Q|||1$l<<< O  #00288:ND  & ; 
!  	ww%,,&83>??		 <<< O   QsF   D+ =D+ =D+ F9E0F+E-62E((E-0 FFF#	c                     V P                   '       d?   \        \        P                  P	                  V P
                  \        V4      4      R4      pM>\        \        P                  P	                  V P
                  \        V4      4      R4      p T;_uu_ 4        V P                   '       d   \        V4        VP                  4       P                  \        R4      V P                   '       d   \        V4       uuRRR4       #   \         d8   pTP                  \        P                  8X  d   \        RT,          4      hh Rp?ii ; i  T P                   '       d   \        T4       i i ; i  + '       g   i     R# ; i)r+  r  r   r  Nr   )r  r!  r   r   r   r   r   r  r  r  r;   r  r   r   r   r  r   r2   r'  r  s   &&  r!   rV   MH.get_bytesP  s    		|||djj#c(;UCdjj#c(;TB Q|||1$vvx''7<<< O Q  	ww%,,&83>??		 <<< O   QQsF   D =D =D E,9#E	E,E2EE	 E))E,,E=	c                    \        \        P                  P                  V P                  \        V4      4      R4      p\        T4      #   \         d8   pTP                  \        P                  8X  d   \        RT,          4      hh Rp?ii ; i)r]   r   r  N)r!  r   r   r   r   r   r  r  r  r;   r/  rR  s   &&  r!   rL   MH.get_filee  sl    	RWW\\$**c#h7>A !}  	ww%,,&83>??		s   =A
 
B2BBc                t    \        \        R \        P                  ! V P                  4       4       4      4      # )r`   c              3   h   "   T F(  pVP                  4       '       g   K  \        V4      x  K*  	  R # 5ir6   )isdigitr  ).0rv  s   & r!   	<genexpr>MH.iterkeys.<locals>.<genexpr>r  s(      :3I%). &3u::3Is   22)iterrF  r   rr  r   ra   s   &r!   rb   MH.iterkeysp  s/    F :2::djj3I : : ; 	;r$   c                    \         P                  P                  \         P                  P                  V P                  \        V4      4      4      # r[  )r   r   r   r   r   r   r1   s   &&r!   r|   MH.__contains__u  s,    ww~~bggll4::s3x@AAr$   c                F    \        \        V P                  4       4      4      # r^  )r_  re   rb   ra   s   &r!   r   
MH.__len__y  s    4())r$   c                &   V'       d   R MRpV'       d   RR/M/ p\         P                  P                  V P                  R4      p  \	        VRV,           3/ VB #   \
         d     Mi ; i \	        TRT,           3/ TB #   \         d     KJ  i ; i)r   bencodingASCIIr>  zr+zx+)r   r   r   r   r!  r  r  )r   textmodekwargsr   s   &&   r!   _open_mh_sequences_fileMH._open_mh_sequences_file}  s    rs*.*g&Bww||DJJ8D$+888$ D$+888" s$   A A)(A)-B BBc                    V P                   '       g6   V P                  RR7      V n        \        V P                  4       RV n         R# R# )r   Frf  TN)r  ri  r  r  ra   s   &r!   r   MH.lock  s8    |||5555ADJtzz"DL r$   c                    V P                   '       d6   \        V P                  4       \        V P                  4       V =RV n         R# R# r  )r  r  r  r   ra   s   &r!   r   	MH.unlock  s4    <<<$

#
 DL	 r$   c                    R# )r   Nrc  ra   s   &r!   r   MH.flush  rg  r$   c                N    V P                   '       d   V P                  4        R# R# rk  )r  r   ra   s   &r!   r   MH.close  s    <<<KKM r$   c                   . p\         P                  ! V P                  4       Fc  p\         P                  P	                  \         P                  P                  V P                  V4      4      '       g   KR  VP                  V4       Ke  	  V# )rn  )r   rr  r   r   rs  r   rt  ru  s   &  r!   rw  MH.list_folders  sW    ZZ

+Eww}}RWW\\$**e<==e$ , r$   c                    \        \        P                  P                  V P                  V4      V P
                  RR7      # )z+Return an MH instance for the named folder.Frz  r   r   r   r   r   r   r{  s   &&r!   r}  MH.get_folder  s-    "'',,tzz62--7 	7r$   c                    \        \        P                  P                  V P                  V4      V P
                  R7      # )z:Create a folder and return an MH instance representing it.r  rw  r{  s   &&r!   r  MH.add_folder  s+    "'',,tzz62--) 	)r$   c                t   \         P                  P                  V P                  V4      p\         P                  ! V4      pVR.8X  d6   \         P
                  ! \         P                  P                  VR4      4       M$V. 8X  d   M\        RV P                  ,          4      h\         P                  ! V4       R# )r  r>  zFolder not empty: %sN)r   r   r   r   rr  r3   r   r  )r   r|  r   entriess   &&  r!   r  MH.remove_folder  sx    ww||DJJ/**T"''IIbggll49:] 6 CDD
r$   c                Z   / p \        \        P                  P                  V P                  R4      RRR7      pT;_uu_ 4        \        T P                  4       4      pT F  p TP                  R4      w  rV\        4       pTP                  4        Fp  pTP                  4       '       d   TP                  \        T4      4       K5  R TP                  R4       4       w  rTP                  \        Y^,           4      4       Kr  	  \        T4       Uu. uF  pY9   g   K  TNK  	  upY&   \        Y,          4      ^ 8X  d   Y K  K  	  R	R	R	4       T#   \
         d    Tu # i ; iu upi   \          d"    \#        RTP%                  4       ,          4      hi ; i  + '       g   i     T# ; i)
z=Return a name-to-key-list dictionary to define each sequence.r>  rre  )rd  r   c              3   8   "   T F  p\        V4      x  K  	  R # 5ir6   )r  )rY  xs   & r!   rZ  #MH.get_sequences.<locals>.<genexpr>  s     *K?a3q66?s   -z"Invalid sequence specification: %sN)r!  r   r   r   r   r  rG  rf   r   rX  r,   r  r   rangerF  r_  r   r   rstrip)r   resultsr'  all_keysr   r   contentsrf   specr  r  r2   s   &           r!   rM  MH.get_sequences  se   	RWW\\$**o>gVA Q499;'H5%)ZZ_ND5D ( 0<<>> HHSY/*K4::c?*KKE KKeAX(>? !1 5;4L %=LS,/O &)SL %=GM7=)Q.#M /  & + ! 	N	%= " 5%&J&*kkm'4 5 55! Q& sN   6E F$B.E*E%
E%
%E*FE"!E"%E**,F	FF*	c                   V P                  RR7      p \        P                  ! \        P                  ! VP                  \        P
                  \        P                  ,          4      4       VP                  4        F  w  r4\        V4      ^ 8X  d   K  VP                  VR,           4       RpRp\        \        V4      4       Fj  pV^,
          V8X  d   V'       g   RpVP                  R4       M;V'       d   RpVP                  V: RV: 24       MVP                  RV,          4       TpKl  	  V'       d$   VP                  \        V4      R	,           4       K  VP                  R	4       K  	  \        V4       R#   \        T4       i ; i)
z:Set sequences using the given name-to-key-list dictionary.Trl  r   NFr   z %s
)ri  r   r   r!  r   r  rJ  rx   r_  r   rF  rG  r   r   )r   	sequencesr'  r   rf   prev
completingr2   s   &&      r!   set_sequencesMH.set_sequences  s   ((d(3	HHRWWQVVR[[2::%=>?'oo/
t9>s
#"
!#d),CQw$))-JGGCL#%*
4 56,D - GGCI,-GGDM) 0, NKNs   CE> E> 8A E> 98E> >Fc                \   V P                  4       p^ p. pV P                  4        F  pV^,
          V8w  d   VP                  WB^,           34        \        P                  ! \        P
                  P                  V P                  \        V4      4      \        P
                  P                  V P                  \        V^,           4      4      4       \        P                  ! \        P
                  P                  V P                  \        V4      4      4       V^,          pK  	  V^,           V n        \        V4      ^ 8X  d   R# VP                  4        F+  w  rVV F   w  rxWv9   g   K  WVP!                  V4      &   K"  	  K-  	  V P#                  V4       R#   \        \        3 d    \        P                  ! \        P
                  P                  T P                  \        T4      4      \        P
                  P                  T P                  \        T^,           4      4      4        ELi ; i)z?Re-name messages to eliminate numbering gaps. Invalidates keys.N)rM  rb   rt  r   r  r   r   r   r   unlinkr  r  r  r  r_  rx   indexr  )	r   r  r  changesr2   r   rO  oldr   s	   &        r!   packMH.pack  s|   &&(	==?CQw$AX/BGGBGGLLSX>GGLLS]CE IIbggll4::s3x@AAID # w<1'oo/ND#?47X^^C01 $ 0 	9% '8 GIIbggll4::s3x@ ggll4::s4!8}EGGs   B FBH+*H+c                *   VP                  4       pV P                  4       pVP                  4        F7  w  rVWS9   d   VP                  V4       K  W&9   g   K&  WfP                  V4       K9  	  V F  pWt9  g   K  V.WG&   K  	  V P	                  V4       R# )z;Inspect a new MHMessage and update sequences appropriately.N)rM  rx   rt  r  r  )r   r+   r2   pending_sequencesall_sequencesr   rO  sequences   &&&     r!   rC  MH._dump_sequences  s    #113**,+113ND($^^C01	 4
 *H,+.%' * 	=)r$   )r  r  r  r   )r   r   r   r   r   r"   r,   r3   rA   rI   rV   rL   rb   r|   r   ri  r   r   r   r   rw  r}  r  r  rM  r  r  rC  r   r   r   s   @r!   r   r     s     
 D02$*	;
B* !
7
)

8:&4* *r$   c                      a  ] tR tRt o Rt]! 0 Rm4      tRR ltR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tRtV tR# )r   i#  zAn Rmail-style Babyl mailbox.Nc                @    \         P                  WW#4       / V n        R# )zInitialize a Babyl mailbox.N)r  r"   _labelsr   s   &&&&r!   r"   Babyl.__init__)  s    ##D@r$   c                    \         P                  W4      p\        V\        4      '       d   VP	                  4       V P
                  V&   V# )r&   )r  r,   r   r   
get_labelsr  )r   r+   r2   s   && r!   r,   	Babyl.add.  s;     $$T3g|,, ' 2 2 4DLL
r$   c                n    \         P                  W4       WP                  9   d   V P                  V R# R# r  )r  r3   r  r1   s   &&r!   r3   Babyl.remove5  s+    !!$,,,S! r$   c                    \         P                  WV4       \        V\        4      '       d    VP	                  4       V P
                  V&   R# R# )r?   N)r  rA   r   r   r  r  r@   s   &&&r!   rA   Babyl.__setitem__;  s;    &&t':g|,, ' 2 2 4DLL -r$   c                   V P                  V4      w  r#V P                  P                  V4       V P                  P                  4        \        P
                  ! 4       p V P                  P                  4       pVR\        ,           8X  g	   V'       g   M'VP                  VP                  \        R4      4       K]  \        P
                  ! 4       p V P                  P                  4       pV\        8X  g	   V'       g   M'VP                  VP                  \        R4      4       KV  W0P                  P                  4       ,
          pV^ 8  g   Q hV P                  P                  V4      pVP                  \        R4      p\        VP                  4       V,           4      p	V	P                  VP                  4       4       WP                  9   d#   V	P                  V P                  V,          4       V	# )rP      *** EOOH ***r   )r  r  r   r   r   r   r   r   r   r  r   r   r   set_visibler  
set_labels)
r   r2   r  r  original_headersr   visible_headersnbodyr(  s
   &&        r!   rI   Babyl.get_messageA  sU   ll3'



::<::&&(D00""4<<#?@**,::&&(Dwd!!$,,w">?::??$$Avvzzq!||GU++446=>0023,,NN4<<,-
r$   c                   V P                  V4      w  r#V P                  P                  V4       V P                  P                  4        \        P
                  ! 4       p V P                  P                  4       pVR\        ,           8X  g	   V'       g   M'VP                  VP                  \        R4      4       K]   V P                  P                  4       pV\        8X  g   V'       d   K0   TP                  4       pY0P                  P                  4       ,
          pT^ 8  g   Q hT P                  P                  T4      pTP                  \        R4      pYh,           # )r  r  r   )r  r  r   r   r   r   r   r   r   r   r  r   )	r   r2   r  r  r  r   headersr  r   s	   &&       r!   rV   Babyl.get_bytes]  s    ll3'



::<::&&(D00""4<<#?@::&&(Dwdd"++-::??$$Avvzzq!||GU+~r$   c                t    \         P                  ! V P                  V4      P                  R\        4      4      # )r]   r   )r   r   rV   r   r   r1   s   &&r!   rL   Babyl.get_files  s'    zz$..-55eWEFFr$   c                    V P                  4        \        4       pV P                  P                  4        F  pVP	                  V4       K  	  VP                  V P                  4       \        V4      # )z4Return a list of user-defined labels in the mailbox.)r  rG  r  rr   r   difference_update_special_labelsre   )r   labels
label_lists   &  r!   r  Babyl.get_labelsw  sS    ,,--/JMM*% 0  !5!56F|r$   c                   . . r!V P                   P                  ^ 4       ^ p. p TpV P                   P                  4       pV P                   P                  4       pVR\        ,           8X  d   \        V4      \        V4      8  d&   VP                  V\        \        4      ,
          4       VP                  V4       V P                   P                  4       R,          P                  R4       Uu. uF+  pVP                  4       '       g   K  VP                  4       NK-  	  ppVP                  V4       EK  VR8X  g   VR\        ,           8X  dE   \        V4      \        V4      8  d)   VP                  V\        \        4      ,
          4       EKk  EKn  V'       d   EKy  VP                  V\        \        4      ,
          4        \        \        \        Y4      4      4      T n        \        \        T4      4      T n        \        T P                  4      T n        T P                   P                  ^ ^4       T P                   P                  4       T n        R# u upi )r'  s   rp     ,   N)r  r   r   r  r   r_  rt  r   stripr(  r)  r*  r   r  r  r  )	r   r+  r,  r:  label_listsr.  r   labelr  s	   &        r!   r  Babyl._generate_toc  s   B

H::&&(Dzz(H{W,,u:F+LLCL!89h'+/::+>+>+@+D+J+J4+P:+P -2+0;;= (%++-+P  : ""6*DGg,=$=u:F+LLCL!89 ,TXG453v#567	Ik23TYY

1 JJOO-:s   -I
Ic                   R\         ,           pVR\         ,           ,          pV P                  4       pR V 4       pVRRP                  V4      ,           \         ,           ,          pVR,          pVP                  V4       R# )r  s   BABYL OPTIONS:s
   Version: 5c              3   @   "   T F  qP                  4       x  K  	  R # 5ir6   )r   )rY  r  s   & r!   rZ  *Babyl._pre_mailbox_hook.<locals>.<genexpr>  s     5fU,,..fs   s   Labels:r  r  N)r   r  r   r   )r   r'  babylr  s   &&  r!   r  Babyl._pre_mailbox_hook  sc    !G+(("5f5dii//'99	r$   c                >    VP                  R\        ,           4       R# )r     Nr$  r  s   &&r!   r  Babyl._pre_message_hook  s    	'!"r$   c                >    VP                  \        R,           4       R# )r  r  Nr$  r  s   &&r!   r  Babyl._post_message_hook  s    	'!"r$   c                   V P                   P                  4       p\        V\        4      '       Ed   . p. pVP	                  4        F7  pWPP
                  9   d   VP                  V4       K&  VP                  V4       K9  	  V P                   P                  R4       V F3  pV P                   P                  RVP                  4       ,           4       K5  	  V P                   P                  R4       V F:  pV P                   P                  RVP                  4       ,           R,           4       K<  	  V P                   P                  \        4       M&V P                   P                  R\        ,           4       \        V\        P                  P                  4      '       Ed>   \        P                  ! 4       p\        P                  P!                  VR^ 4      pVP#                  V4       VP%                  ^ 4        VP'                  4       pV P                   P                  VP)                  R	\        4      4       VR	8X  g   V'       d   KQ   T P                   P                  R
\        ,           4       \        T\        4      '       d   \        P                  ! 4       p	\        P                  P!                  T	R^ 4      p
T
P#                  TP+                  4       4        T	P'                  4       pT P                   P                  TP)                  R	\        4      4       TR	8X  g   T'       d   KQ  McTP%                  ^ 4        TP'                  4       pT P                   P                  TP)                  R	\        4      4       TR	8X  g   T'       d   KQ    TP-                  R4      pT'       g   EMT P                   P                  TP)                  R	\        4      4       KM  \        V\.        \0        \        P2                  34      '       Ed   \        V\        P2                  4      '       d-   \4        P6                  ! R\8        ^4       VP;                  4       p\        V\0        4      '       d   V P=                  V4      pVP?                  R4      ^,           pV^,
          R8w  d   V P                   P                  VRV P)                  R	\        4      4       V P                   P                  R
\        ,           4       V P                   P                  VRV P)                  R	\        4      4       V P                   P                  WR P)                  R	\        4      4       EMfV P                   P                  R
\        ,           \        ,           4       V P                   P                  VP)                  R	\        4      4       EM\A        VR4      '       Ed   \A        VR4      '       d)   \4        P6                  ! R\8        ^4       VPB                  pVP                  4       pRp VP'                  4       pVPE                  R4      '       d   VRR R	,           pM#VPE                  R4      '       d   VRR R	,           pV P                   P                  VP)                  R	\        4      4       VR	8X  g   V'       d   K  V'       d<   RpV P                   P                  R
\        ,           4       VP%                  V4       K    TP'                  4       pT'       g   MTPE                  R4      '       d   TRR \        ,           pMOTPE                  R4      '       d   TRR \        ,           pM'TPE                  R	4      '       d   TRR \        ,           pT P                   P                  T4       K  \G        R\I        V4      ,          4      hV P                   P                  4       pW/3# )z0Write message contents and return (start, stop).   1s   , s   ,,    r  s   1,,FTr   r  r  r   s   

Nr   r   r   r   r   r   r   r   )%r  r  r   r   r  r  rt  r   r   r   rT   r+   r	   r   r   r   r   r   r   r   r   get_visibler   r   r   r   r   r   r   r   r   r  r   r   r   r   r   )r   r+   r  special_labelsr  r  orig_bufferorig_generatorr   
vis_buffervis_generatorr   
body_startoriginal_pos
first_passr  s   &&              r!   r  Babyl._install_message  s   

!g|,,NF ++-000"))%0MM%(	 .
 JJT"'

  !78 (JJU#

  !6!=>  JJW%JJVg-.gu}}4455**,K"__;;KPQRN""7+Q"++-

  eW!=>5=JJ_w67'<00ZZ\
 % > >z5RS T%%g&9&9&;<%..0DJJ$$T\\%%ABu}DD  #&//1DJJ$$T\\%%ABu}DD$))$/

  w!?@%bkk!:;;'2;;// *+=qB!**,'3''//8 g.2JA~#

  *!5!=!=eW!MN

  7!:;

  *!5!=!=eW!MN

  !5!=!=eW!MN

  7!:W!DE

  !@AWj))w)) 56H!M!.."<<>LJ'')==))9u,D]]5))9u,D

  eW!=>5=!%*


((7)BC\2'')==))9w.D]]5))9w.D]]5))9w.D

  &6gFGGzz }r$   )r  r  r  r   >   filededitedresentunseendeletedanswered	forwardedr   )r   r   r   r   r   	frozensetr  r"   r,   r3   rA   rI   rV   rL   r  r  r  r  r  r  r   r   r   s   @r!   r   r   #  sb     ' !B CO
"58,G.<##i ir$   c                   :   a  ] tR tRt o RtRR ltR tR tRtV t	R# )	r	   i  z0Message with mailbox-format-specific properties.Nc                ~   \        V\        P                  P                  4      '       dQ   V P	                  \
        P                  ! V4      4       \        V\        4      '       d   VP                  V 4       R# R# \        V\        4      '       d(   V P	                  \        P                  ! V4      4       R# \        V\        4      '       d(   V P	                  \        P                  ! V4      4       R# \        V\        P                  4      '       d(   V P	                  \        P                  ! V4      4       R# \        VR4      '       d(   V P	                  \        P                   ! V4      4       R# Vf,   \        P                  P                  P#                  V 4       R# \%        R\'        V4      ,          4      h)zInitialize a Message instance.r   Nr   )r   rT   r+   r	   _become_messagecopydeepcopy_explain_tor   rU   r   message_from_stringr   TextIOWrappermessage_from_filer   message_from_binary_filer"   r   r   r*   s   &&r!   r"   Message.__init__  s    gu}}4455  w!78'7++##D) ,''  !9!9'!BC%%  !:!:7!CD!1!122  !8!8!ABWf%%  !?!?!HI_MM!!**406gFGGr$   c                    \        VR. 4      pVP                   F+  pW29  g   K  VP                  V,          V P                  V&   K-  	  R# )z0Assume the non-format-specific state of message._type_specific_attributesN)getattr__dict__)r   r+   type_specificr   s   &&  r!   r  Message._become_message2  s@    )DbI$$D(&-&6&6t&<d# %r$   c                H    \        V\        4      '       d   R# \        R4      h)z:Copy format-specific state to message insofar as possible.Nz Cannot convert to specified type)r   r	   r   r*   s   &&r!   r  Message._explain_to9  s    gw''>??r$   rc  r6   )
r   r   r   r   r   r"   r  r  r   r   r   s   @r!   r	   r	     s     :H&=@ @r$   c                   x   a  ] tR tRt o Rt. ROtRR ltR tR tR t	R t
R	 tR
 tR tR tR tR tR tRtV tR# )r
   iA  z)Message with Maildir-specific properties.Nc                    RV n         RV n        \        P                  ! 4       V n        \        P                  W4       R# )z%Initialize a MaildirMessage instance.r   r   N)_subdir_infor  _dater	   r"   r*   s   &&r!   r"   MaildirMessage.__init__F  s+    
YY[
'r$   c                    V P                   # )zReturn 'new' or 'cur'.)r  ra   s   &r!   r   MaildirMessage.get_subdirM  s    ||r$   c                R    VR8X  g   VR8X  d	   Wn         R# \        RV,          4      h)zSet subdir to 'new' or 'cur'.r   r   z!subdir must be 'new' or 'cur': %sN)r  r   )r   r
  s   &&r!   r"  MaildirMessage.set_subdirQ  s%    U?fo!L@6IJJr$   c                n    V P                   P                  R4      '       d   V P                   R,          # R# )*Return as a string the flags that are set.r?  r@  r   )r  r   ra   s   &r!   rA  MaildirMessage.get_flagsX  s(    ::  &&::b>!r$   c                R    RRP                  \        V4      4      ,           V n        R# ))Set the given flags and unset all others.r?  r   N)r   rF  r  )r   rD  s   &&r!   rH  MaildirMessage.set_flags_  s    BGGF5M22
r$   c                    V P                  RP                  \        V P                  4       4      \        V4      ,          4      4       R# z.Set the given flag(s) without changing others.r   NrH  r   rG  rA  r   rL  s   &&r!   rP  MaildirMessage.add_flagc  ,    rwws4>>#34s4y@ABr$   c                    V P                  4       '       dJ   V P                  RP                  \        V P                  4       4      \        V4      ,
          4      4       R# R# )7Unset the given string flag(s) without changing others.r   N)rA  rH  r   rG  r
  s   &&r!   rT  MaildirMessage.remove_flagg  s>    >>NN2773t~~'7#83t9#DEF r$   c                    V P                   # )z<Return delivery date of message, in seconds since the epoch.)r  ra   s   &r!   r  MaildirMessage.get_datel      zzr$   c                l     \        V4      V n        R#   \         d    \        RT,          4      Rhi ; i)z9Set delivery date of message, in seconds since the epoch.zcan't convert to float: %sN)floatr  r   r   )r   dates   &&r!   r$  MaildirMessage.set_datep  s7    	KtDJ 	K84?@dJ	Ks    3c                    V P                   # )z%Get the message's "info" as a string.)r  ra   s   &r!   r   MaildirMessage.get_infow  r  r$   c                t    \        V\        4      '       d	   Wn        R# \        R\	        V4      ,          4      h)z Set the message's "info" string.zinfo must be a string: %sN)r   r   r  r   r   )r   r5  s   &&r!   r#  MaildirMessage.set_info{  s)    dC  J7$t*DEEr$   c                D   \        V\        4      '       d`   VP                  V P                  4       4       VP	                  V P                  4       4       VP                  V P                  4       4       R# \        V\        4      '       d   \        V P                  4       4      pRV9   d   VP                  R4       V P                  4       R8X  d   VP                  R4       RV9   d   VP                  R4       RV9   d   VP                  R4       RV9   d   VP                  R4       VP                  R	\        P                  ! V P                  4       4      4       R# \        V\        4      '       df   \        V P                  4       4      pRV9  d   VP                  R
4       RV9   d   VP                  R4       RV9   d   VP                  R4       R# R# \        V\         4      '       d~   \        V P                  4       4      pRV9  d   VP#                  R
4       RV9   d   VP#                  R4       RV9   d   VP#                  R4       RV9   d   VP#                  R4       R# R# \        V\$        4      '       d   R# \'        R\)        V4      ,          4      h)z;Copy Maildir-specific state to message insofar as possible.SRr   OTDFAMAILER-DAEMONr  repliedflaggedr  r  r  r  $Cannot convert to specified type: %sN)r   r
   rH  rA  r"  r   r$  r  r  rG  rP  r  r  r  r   rN  r   	add_labelr	   r   r   )r   r+   rD  s   && r!   r  MaildirMessage._explain_to  s   g~..dnn./t01T]]_-!122()Ee|  % E)  %e|  %e|  %e|  %_dkk$--/.JK++()E%$$X.e|$$Y/e|$$Y/ ..()E%!!(+e|!!),e|!!*-e|!!+. ))B M* + +r$   )r  r  r  )r  r  r  r6   )r   r   r   r   r   r  r"   r   r"  rA  rH  rP  rT  r  r$  r   r#  r  r   r   r   s   @r!   r
   r
   A  sT     3 =(K3CG
KF)+ )+r$   c                   b   a  ] tR tRt o RtR.tRR ltR tRR ltR t	R	 t
R
 tR tR tRtV tR# )r  i  z/Message with mbox- or MMDF-specific properties._fromNc                .   V P                  RR4       \        V\        P                  P                  4      '       dD   VP                  4       pVe0   VP                  R4      '       d   V P                  VR,          4       \        P                  W4       R# )z'Initialize an mboxMMDFMessage instance.r#  TNzFrom r   )r  r   rT   r+   r	   r  r   r"   )r   r+   r  s   && r!   r"   _mboxMMDFMessage.__init__  si    ot,gu}}4455++-H#(;(;G(D(Dhrl+'r$   c                    V P                   # )z Return contents of "From " line.r*  ra   s   &r!   r  _mboxMMDFMessage.get_from  r  r$   c                    Ve@   VRJ d   \         P                  ! 4       pVR\         P                  ! V4      ,           ,          pWn        R# )z>Set "From " line, formatting and appending time_ if specified.NTr  )r  r  r  r*  )r   r  time_s   &&&r!   r  _mboxMMDFMessage.set_from  s7    }S4<<...E
r$   c                T    V P                  RR4      V P                  RR4      ,           # )r  Statusr   X-Status)rF   ra   s   &r!   rA  _mboxMMDFMessage.get_flags  s#    xx"%R(@@@r$   c                   \        V4      pRRr2R F$  pWA9   g   K  W$,          pVP                  V4       K&  	  R F$  pWA9   g   K  W4,          pVP                  V4       K&  	  VRP                  \        V4      4      ,          p V P	                  RV4        V P	                  RV4       R#   \
         d    T P                  RT4        L4i ; i  \
         d    T P                  RT4        R# i ; i)r  r   r4  r5  N)r  r  )r   r!  r"  )rG  r3   r   rF  replace_headerr;   
add_header)r   rD  status_flagsxstatus_flagsrL  s   &&   r!   rH  _mboxMMDFMessage.set_flags  s    E
&("mD}$T"  $D}%T" $ 	//	4,7	7
M:  	4OOHl3	4  	7OOJ6	7s$   B, C ,CCC0/C0c                    V P                  RP                  \        V P                  4       4      \        V4      ,          4      4       R# r  r	  r
  s   &&r!   rP  _mboxMMDFMessage.add_flag  r  r$   c                    RV 9   g   RV 9   dJ   V P                  RP                  \        V P                  4       4      \        V4      ,
          4      4       R# R# )r  r4  r5  r   Nr	  r
  s   &&r!   rT  _mboxMMDFMessage.remove_flag  s@    tzT1NN2773t~~'7#83t9#DEF  2r$   c                v   \        V\        4      '       Ed   \        V P                  4       4      pRV9   d   VP	                  R4       RV9   d   VP                  R4       RV9   d   VP                  R4       RV9   d   VP                  R4       RV9   d   VP                  R4       VR	 VR
 RP                  V P                  4       P                  4       RR 4      p VP                  \        P                  ! \        P                  ! VR4      4      4       R# \        V\         4      '       dA   VP#                  V P                  4       4       VP%                  V P                  4       4       R# \        V\&        4      '       dj   \        V P                  4       4      pRV9  d   VP)                  R4       RV9   d   VP)                  R4       RV9   d   VP)                  R4       VR	 VR
 R# \        V\*        4      '       dj   \        V P                  4       4      pRV9  d   VP-                  R4       RV9   d   VP-                  R4       RV9   d   VP-                  R4       VR	 VR
 R# \        V\.        4      '       d   R# \1        R\3        V4      ,          4      h  \        \        3 d     R# i ; i)zACopy mbox- or MMDF-specific state to message insofar as possible.r  r   r!  r"  r  r  r   r  statuszx-statusr  Nz%a %b %d %H:%M:%S %Yr  r$  r%  r  r  r&  )r   r
   rG  rA  r"  rP  r   r  r   r$  calendartimegmr  strptimer   OverflowErrorr  rH  r  r   rN  r   r'  r	   r   r   )r   r+   rD  
maybe_dates   &&  r!   r  _mboxMMDFMessage._explain_to  sH   g~..()Ee|""5)e|  %e|  %e|  %e|  %!
#$--/"7"7"9"#">?J  z6L2N "O P !122dnn./T]]_-++()E%$$X.e|$$Y/e|$$Y/!
#..()E%!!(+e|!!),e|!!*-!
#))B M* + +9 . s    :J# #J87J8r.  r6   )r   r   r   r   r   r  r"   r  r  rA  rH  rP  rT  r  r   r   r   s   @r!   r  r    s@     9!(	(A7,CG
1+ 1+r$   r  c                       ] tR tRtRtRtR# )r   i  z&Message with mbox-specific properties.rc  Nr   r   r   r   r   r   rc  r$   r!   r   r         0r$   c                   R   a  ] tR tRt o RtR.tRR ltR tR tR t	R	 t
R
 tRtV tR# )r   i#  z$Message with MH-specific properties.
_sequencesNc                >    . V n         \        P                  W4       R# )z!Initialize an MHMessage instance.N)rN  r	   r"   r*   s   &&r!   r"   MHMessage.__init__(  s    'r$   c                (    V P                   R,          # )z4Return a list of sequences that include the message.NNNrN  ra   s   &r!   rM  MHMessage.get_sequences-  s    q!!r$   c                &    \        V4      V n        R# )z3Set the list of sequences that include the message.N)re   rN  )r   r  s   &&r!   r  MHMessage.set_sequences1  s    y/r$   c                    \        V\        4      '       d0   WP                  9   g   V P                  P                  V4       R# R# \	        R\        V4      ,          4      h)z8Add sequence to list of sequences including the message.zsequence type must be str: %sN)r   r   rN  rt  r   r   r   r  s   &&r!   rN  MHMessage.add_sequence5  sG    h$$.&&x0 / ;d8nLMMr$   c                b     V P                   P                  V4       R#   \         d     R# i ; i)zARemove sequence from the list of sequences including the message.N)rN  r3   r   rX  s   &&r!   remove_sequenceMHMessage.remove_sequence=  s+    	OO""8, 		    ..c                   \        V\        4      '       d   \        V P                  4       4      pRV9   d   VP	                  R4       M"VP	                  R4       VP                  R4       RV9   d   VP                  R4       RV9   d   VP                  R4       R# R# \        V\        4      '       dx   \        V P                  4       4      pRV9  d   VP                  R4       MVP                  R	4       RV9   d   VP                  R4       RV9   d   VP                  R
4       R# R# \        V\        4      '       d+   V P                  4        F  pVP                  V4       K  	  R# \        V\        4      '       dN   \        V P                  4       4      pRV9   d   VP                  R4       RV9   d   VP                  R4       R# R# \        V\        4      '       d   R# \        R\        V4      ,          4      h)z6Copy MH-specific state to message insofar as possible.r  r   r  r%  r!  r$  r  ROr  r"  r  r&  N)r   r
   rG  rM  r"  rP  r  r   rN  r   r'  r	   r   r   )r   r+   r  r  s   &&  r!   r  MHMessage._explain_toD  s   g~..D..01I9$""5)""5)  %I%  %I%  % &!122D..01Iy(  &  %I%  %I%  % &++ ..0$$X. 1..D..01I9$!!(+I%!!*- &))B M* + +r$   rS  r6   )r   r   r   r   r   r  r"   rM  r  rN  r[  r  r   r   r   s   @r!   r   r   #  s4     .!-(
"*N$+ $+r$   c                   f   a  ] tR tRt o RtRR.tRR ltR tR tR	 t	R
 t
R tR tR tR tRtV tR# )r   ik  z'Message with Babyl-specific properties.r  _visibleNc                \    . V n         \        4       V n        \        P                  W4       R# )z#Initialize a BabylMessage instance.N)r  r	   rb  r"   r*   s   &&r!   r"   BabylMessage.__init__p  s     	'r$   c                (    V P                   R,          # )z'Return a list of labels on the message.rR  )r  ra   s   &r!   r  BabylMessage.get_labelsv  s    ||Ar$   c                &    \        V4      V n        R# )z&Set the list of labels on the message.N)re   r  )r   r  s   &&r!   r  BabylMessage.set_labelsz  s    F|r$   c                    \        V\        4      '       d0   WP                  9  d   V P                  P                  V4       R# R# \	        R\        V4      ,          4      h)z+Add label to list of labels on the message.zlabel must be a string: %sN)r   r   r  rt  r   r   r   r  s   &&r!   r'  BabylMessage.add_label~  sG    eS!!LL(##E* ) 84;FGGr$   c                b     V P                   P                  V4       R#   \         d     R# i ; i)z4Remove label from the list of labels on the message.N)r  r3   r   rj  s   &&r!   remove_labelBabylMessage.remove_label  s+    	LL& 		r]  c                ,    \        V P                  4      # )z3Return a Message representation of visible headers.r	   rb  ra   s   &r!   r  BabylMessage.get_visible  s    t}}%%r$   c                &    \        V4      V n        R# )z2Set the Message representation of visible headers.Nrp  )r   visibles   &&r!   r  BabylMessage.set_visible  s    (r$   c                &   V P                   P                  4        F:  pW9   d%   V P                   P                  WV,          4       K-  V P                   V K<  	  R F2  pW9   g   K  WP                   9  g   K  W,          V P                   V&   K4  	  R# )z9Update and/or sensibly generate a set of visible headers.N)DateFromzReply-ToToCCSubject)rb  rf   r8  )r   headers   & r!   update_visibleBabylMessage.update_visible  sl    mm((*F~,,V&\BMM&)	 +
 JF~&"=(,f% Jr$   c                   \        V\        4      '       d   \        V P                  4       4      pRV9   d   VP	                  R4       M"VP	                  R4       VP                  R4       RV9   g   RV9   d   VP                  R4       RV9   d   VP                  R4       R	V9   d   VP                  R
4       R# R# \        V\        4      '       dx   \        V P                  4       4      pRV9  d   VP                  R4       MVP                  R4       R	V9   d   VP                  R4       RV9   d   VP                  R4       R# R# \        V\        4      '       dN   \        V P                  4       4      pRV9   d   VP                  R4       RV9   d   VP                  R4       R# R# \        V\        4      '       dJ   VP                  V P                  4       4       V P                  4        F  pVP                  V4       K  	  R# \        V\        4      '       d   R# \        R\        V4      ,          4      h)z9Copy Babyl-specific state to message insofar as possible.r  r   r  r  r  r  r  r  r  r  r_  r  r   r"  r$  r&  N)r   r
   rG  r  r"  rP  r  r   rN  r   r  r  r'  r	   r   r   )r   r+   r  r  s   &&  r!   r  BabylMessage._explain_to  s   g~..*+F6!""5)""5)  %f$F(:  %V#  %F"  % #!122*+Fv%  &  %F"  %V#  % $++*+F6!$$X.V#$$Y/ $.. 0 0 23*!!%( +))B M* + +r$   )r  rb  r6   )r   r   r   r   r   r  r"   r  r  r'  rm  r  r  r|  r  r   r   r   s   @r!   r   r   k  sF     1!*J 7($H&)	5'+ '+r$   c                       ] tR tRtRtRtR# )r   i  z&Message with MMDF-specific properties.rc  NrK  rc  r$   r!   r   r     rL  r$   c                      a  ] tR tRt o RtRR ltRR ltRR ltRR ltRR lt	R	 t
R
 tRR ltR tR tR tR tR tR tR tR t]R 4       t]! ]4      tRtV tR# )r/  i  zA read-only wrapper of a file.Nc                T    Wn         Vf   VP                  4       V n        R# W n        R# )zInitialize a _ProxyFile.N)r  r  _pos)r   r'  poss   &&&r!   r"   _ProxyFile.__init__  s    
;DIIr$   c                L    V P                  WP                  P                  4      # zRead bytes.)_readr  r   r   sizes   &&r!   r   _ProxyFile.read  s    zz$

00r$   c                L    V P                  WP                  P                  4      # r  )r  r  read1r  s   &&r!   r  _ProxyFile.read1  s    zz$

 0 011r$   c                L    V P                  WP                  P                  4      # )zRead a line.)r  r  r   r  s   &&r!   r   _ProxyFile.readline  s    zz$

 3 344r$   c                    . pV  F6  pVP                  V4       Vf   K  V\        V4      ,          pV^ 8:  g   K5   V# 	  V# )zRead multiple lines.)rt  r_  )r   sizehintr   r   s   &&  r!   	readlines_ProxyFile.readlines  sG    DMM$#CI%q=  r$   c              #  J   "   V P                  4       ;p'       d   Vx  K  R# 5i)zIterate over lines.N)r   )r   r   s   & r!   ro   _ProxyFile.__iter__  s      mmo%d%J &s   ##c                    V P                   # )zReturn the position.)r  ra   s   &r!   r  _ProxyFile.tell  s    yyr$   c                    V^8X  d&   V P                   P                  V P                  4       V P                   P                  W4       V P                   P                  4       V n        R# )zChange position.Nr  r   r  r  r   offsetwhences   &&&r!   r   _ProxyFile.seek  s?    Q;JJOODII&

'JJOO%	r$   c                    \        V R4      '       d<    \        V P                  R4      '       d   V P                  P                  4        V =R# R#   T =i ; i)zClose the file.r  r   N)r   r  r   ra   s   &r!   r   _ProxyFile.close   sH    4!!4::w//JJ$$&J "
 Js   6A Ac                    Vf   RpV P                   P                  V P                  4       V! V4      pV P                   P                  4       V n        V# )z"Read size bytes using read_method.r   r  )r   r  read_methodr   s   &&& r!   r  _ProxyFile._read	  sA    <D

		"T"JJOO%	r$   c                    V # )z$Context management protocol support.rc  ra   s   &r!   	__enter___ProxyFile.__enter__  s    r$   c                &    V P                  4        R # r6   )r   )r   excs   &*r!   __exit___ProxyFile.__exit__  s    

r$   c                6    V P                   P                  4       # r6   )r  readablera   s   &r!   r  _ProxyFile.readable      zz""$$r$   c                6    V P                   P                  4       # r6   )r  writablera   s   &r!   r  _ProxyFile.writable  r  r$   c                6    V P                   P                  4       # r6   )r  seekablera   s   &r!   r  _ProxyFile.seekable  r  r$   c                6    V P                   P                  4       # r6   )r  r   ra   s   &r!   r   _ProxyFile.flush"  s    zz!!r$   c                    \        V R 4      '       g   R# \        V P                  R4      '       g   R# V P                  P                  # )r  TrE  F)r   r  rE  ra   s   &r!   rE  _ProxyFile.closed%  s6    tW%%tzz8,,zz   r$   )r  r  r6       )r   r   r   r   r   r"   r   r  r   r  ro   r  r   r   r  r  r  r  r  r  r   propertyrE  r   r   r   r   r   r   s   @r!   r/  r/    sy     (125	
&%%%" ! ! $L1r$   r/  c                   J   a  ] tR tRt o RtR
R ltR tRR ltR tR t	R	t
V tR# )r  i0  z&A read-only wrapper of part of a file.Nc                J    \         P                  WV4       W n        W0n        R# )zInitialize a _PartialFile.N)r/  r"   _start_stop)r   r'  r  r  s   &&&&r!   r"   _PartialFile.__init__3  s    DU+
r$   c                N    \         P                  V 4      V P                  ,
          # )z*Return the position with respect to start.)r/  r  r  ra   s   &r!   r  _PartialFile.tell9  s    t$t{{22r$   c                    V^ 8X  d   V P                   V n        ^pMV^8X  d   V P                  V n        ^p\        P	                  WV4       R# )z8Change position, possibly with respect to start or stop.N)r  r  r  r/  r   r  s   &&&r!   r   _PartialFile.seek=  s>    Q;DIFq[

DIFf-r$   c                    V P                   V P                  ,
          pV^ 8:  d   R# Ve   V^ 8  g   W8  d   Tp\        P                  WV4      # )z;Read size bytes using read_method, honoring start and stop.r$   )r  r  r/  r  )r   r  r  	remainings   &&& r!   r  _PartialFile._readG  sF    JJ*	><4!8t'7DK88r$   c                2    \        V R 4      '       d   V =R# R# )r  N)r   r  ra   s   &r!   r   _PartialFile.closeP  s     4!!
 "r$   )r  r  r  )NNr  )r   r   r   r   r   r"   r  r   r  r   r   r   r   s   @r!   r  r  0  s&     03.9 r$   r  c                   Rp \         '       d<    \         P                  ! V \         P                  \         P                  ,          4       V'       d    \        V P                  R,           4      pVP                  4          \        P                  ! TP                  T P                  R,           4       Rp\        P                  ! TP                  4       R# R#   \         da   pTP
                  \
        P                  \
        P                  \
        P                  39   d   \        RT P                  ,          4      hh Rp?ii ; i  \         d<   pTP
                  \
        P                  \
        P                  39   d    Rp?R# h Rp?ii ; i  \         \"        3 d9    \        P$                  ! TP                  T P                  R,           4       Rp R# i ; i  \&         d>    \        P(                  ! TP                  4       \        RT P                  ,          4      hi ; i   \         '       d&   \         P                  ! T \         P*                  4       T'       d(   \        P(                  ! T P                  R,           4       h ; i)z(Lock file f using lockf and dot locking.Fzlockf: lock unavailable: %sN.lockTzdot lock unavailable: %s)fcntllockfLOCK_EXLOCK_NBr  r  EAGAINr  r  r   r   r  r   r   r  r  r  r  r  r  r3   LOCK_UN)r'  r  dotlock_doner  pre_locks   &&   r!   r  r  W  s   L%5Au}}u}}<= ,QVVg-=> 1-GGHMM166G+;<#'L
 IIhmm,#   77u||U\\5;;GG,-J-.VV.4 5 5   77u||U[[99	 '8 (IIhmmQVVg-=>#'L(
 # 1		(--(()C)**0 1 115KK5==)IIaffw&'s   H( :C H( ,E 4F 6 G E%AE  EH( F/F	H( F		FH( AGG GG AH%%H( (:J#(Jc                &   \         '       d&   \         P                  ! V \         P                  4       \        P                  P                  V P                  R,           4      '       d*   \        P                  ! V P                  R,           4       R# R# )z*Unlock file f using lockf and dot locking.r  N)r  r  r  r   r   r   r   r3   r'  s   &r!   r  r    sO    uAu}}%	ww~~affw&''
		!&&7"# (r$   c                   \         P                  ! V \         P                  \         P                  ,          \         P                  ,          R4      p \        V R4      \         P
                  ! V4       #   \         P
                  ! T4       i ; i)zCCreate a file if it doesn't exist and open for reading and writing.r  r  )r   r!  r  r?  O_RDWRr   )r   fds   & r!   r  r    sP    	rzzBII-		95	ABD% 
s   A4 4Bc           
         \        V : R\        \        P                  ! 4       4      : R\        P                  ! 4       : R\
        P                  ! 4       : 24      # )zBCreate a temp file based on path and open for reading and writing.ro  )r  r  r  r  r  r   r  )r   s   &r!   r  r    s8    dC		4D.4.@.@.B.0iik; < <r$   c                    V P                  4        \        \        R4      '       d'   \        P                  ! V P	                  4       4       R# R# )z0Ensure changes to file f are physically on disk.fsyncN)r   r   r   r  filenor  s   &r!   r  r    s/    GGIr7
 r$   c                <    \        V 4       V P                  4        R# )z:Close file f, ensuring all changes are physically on disk.N)r  r   r  s   &r!   r   r     s    NGGIr$   c                       ] tR tRtRtRtR# )r   i  z"Raised for module-specific errors.rc  NrK  rc  r$   r!   r   r     s    ,r$   c                       ] tR tRtRtRtR# )r   i  z:The specified mailbox does not exist and won't be created.rc  NrK  rc  r$   r!   r   r     s    Dr$   c                       ] tR tRtRtRtR# )r   i  z>The specified mailbox is not empty and deletion was requested.rc  NrK  rc  r$   r!   r   r     s    Hr$   c                       ] tR tRtRtRtR# )r   i  z)Another process caused an action to fail.rc  NrK  rc  r$   r!   r   r         3r$   c                       ] tR tRtRtRtR# )r   i  z)A file appears to have an invalid format.rc  NrK  rc  r$   r!   r   r     r  r$   )r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   )T)2r   r   r  rD  r  r  r  r   rT   email.messageemail.generatorr   rJ   typesr   r  ImportError__all__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   	Exceptionr   r   r   r   r   rc  r$   r!   <module>r     s   J 
          	  A
 **

G
$f2 f2Rgg gTC CN@" @F1.9 1.h*.9 *.Z@* @*F
v vr"@emm## "@Jj+W j+Zn+w n+b1" 1E+ E+P\+7 \+~1" 1_2 _2D$: $N(T$<-I -E EIE I4 44% 4mD  Es   E7 7	FF