ok
Direktori : /proc/thread-self/root/proc/thread-self/root/lib64/python2.7/ |
Current File : //proc/thread-self/root/proc/thread-self/root/lib64/python2.7/mhlib.pyc |
� zfc @ s| d Z d d l m Z e d d d �[ d Z d Z d Z d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d d d g Z d e f d � � YZ d f d � � YZ e j d � Z d � Z d f d � � YZ d e j f d � � YZ d e f d � � YZ d f d � � YZ d d � Z d d � Z d � Z e d k rxe � n d S( s� MH interface -- purely object-oriented (well, almost) Executive summary: import mhlib mh = mhlib.MH() # use default mailbox directory and profile mh = mhlib.MH(mailbox) # override mailbox location (default from profile) mh = mhlib.MH(mailbox, profile) # override mailbox and profile mh.error(format, ...) # print error message -- can be overridden s = mh.getprofile(key) # profile entry (None if not set) path = mh.getpath() # mailbox pathname name = mh.getcontext() # name of current folder mh.setcontext(name) # set name of current folder list = mh.listfolders() # names of top-level folders list = mh.listallfolders() # names of all folders, including subfolders list = mh.listsubfolders(name) # direct subfolders of given folder list = mh.listallsubfolders(name) # all subfolders of given folder mh.makefolder(name) # create new folder mh.deletefolder(name) # delete folder -- must have no subfolders f = mh.openfolder(name) # new open folder object f.error(format, ...) # same as mh.error(format, ...) path = f.getfullname() # folder's full pathname path = f.getsequencesfilename() # full pathname of folder's sequences file path = f.getmessagefilename(n) # full pathname of message n in folder list = f.listmessages() # list of messages in folder (as numbers) n = f.getcurrent() # get current message f.setcurrent(n) # set current message list = f.parsesequence(seq) # parse msgs syntax into list of messages n = f.getlast() # get last message (0 if no messagse) f.setlast(n) # set last message (internal use only) dict = f.getsequences() # dictionary of sequences in folder {name: list} f.putsequences(dict) # write sequences back to folder f.createmessage(n, fp) # add message from file f as number n f.removemessages(list) # remove messages in list from folder f.refilemessages(list, tofolder) # move messages in list to other folder f.movemessage(n, tofolder, ton) # move one message to a given destination f.copymessage(n, tofolder, ton) # copy one message to a given destination m = f.openmessage(n) # new open message object (costs a file descriptor) m is a derived class of mimetools.Message(rfc822.Message), with: s = m.getheadertext() # text of message's headers s = m.getheadertext(pred) # text of message's headers, filtered by pred s = m.getbodytext() # text of message's body, decoded s = m.getbodytext(0) # text of message's body, not decoded i����( t warnpy3ksO the mhlib module has been removed in Python 3.0; use the mailbox module insteadt stackleveli s ~/.mh_profiles ~/Mails .mh_sequencesi� N( t bisectt MHt Errort Foldert Messagec B s e Z RS( ( t __name__t __module__( ( ( s /usr/lib64/python2.7/mhlib.pyR [ s c B s� e Z d Z d d d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z RS( s< Class representing a particular collection of folders. Optional constructor arguments are the pathname for the directory containing the collection, and the MH profile to use. If either is omitted or empty a default is used; the default directory is taken from the MH profile if it is specified there.c C s� | d k r t } n t j j | � | _ | d k rH | j d � } n | sW t } n t j j | � r� | d d k r� t j j d | � } n t j j | � } t j j | � s� t d � n | | _ d S( s Constructor.t Pathi t ~s MH() path not foundN( t Nonet MH_PROFILEt ost patht expandusert profilet getprofilet PATHt isabst joint isdirR ( t selfR R ( ( s /usr/lib64/python2.7/mhlib.pyt __init__f s # c C s d | j | j f S( s String representation.s MH(%r, %r)( R R ( R ( ( s /usr/lib64/python2.7/mhlib.pyt __repr__r s c G s t j j d | | � d S( sA Routine to print an error. May be overridden by a derived class.s MH error: %s N( t syst stderrt write( R t msgt args( ( s /usr/lib64/python2.7/mhlib.pyt errorv s c C s t | j | � S( s* Return a profile entry, None if not found.( t picklineR ( R t key( ( s /usr/lib64/python2.7/mhlib.pyR z s c C s | j S( s9 Return the path (the name of the collection's directory).( R ( R ( ( s /usr/lib64/python2.7/mhlib.pyt getpath~ s c C s7 t t j j | j � d � d � } | s3 d } n | S( s&