當前位置: 首頁>>代碼示例>>Python>>正文


Python mhlib.MH屬性代碼示例

本文整理匯總了Python中mhlib.MH屬性的典型用法代碼示例。如果您正苦於以下問題:Python mhlib.MH屬性的具體用法?Python mhlib.MH怎麽用?Python mhlib.MH使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在mhlib的用法示例。


在下文中一共展示了mhlib.MH屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import mhlib [as 別名]
# 或者: from mhlib import MH [as 別名]
def __init__(self, path = None, profile = None):
        """Constructor."""
        if profile is None: profile = MH_PROFILE
        self.profile = os.path.expanduser(profile)
        if path is None: path = self.getprofile('Path')
        if not path: path = PATH
        if not os.path.isabs(path) and path[0] != '~':
            path = os.path.join('~', path)
        path = os.path.expanduser(path)
        if not os.path.isdir(path): raise Error, 'MH() path not found'
        self.path = path 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:13,代碼來源:mhlib.py

示例2: __repr__

# 需要導入模塊: import mhlib [as 別名]
# 或者: from mhlib import MH [as 別名]
def __repr__(self):
        """String representation."""
        return 'MH(%r, %r)' % (self.path, self.profile) 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:5,代碼來源:mhlib.py

示例3: error

# 需要導入模塊: import mhlib [as 別名]
# 或者: from mhlib import MH [as 別名]
def error(self, msg, *args):
        """Routine to print an error.  May be overridden by a derived class."""
        sys.stderr.write('MH error: %s\n' % (msg % args)) 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:5,代碼來源:mhlib.py

示例4: test

# 需要導入模塊: import mhlib [as 別名]
# 或者: from mhlib import MH [as 別名]
def test():
    global mh, f
    os.system('rm -rf $HOME/Mail/@test')
    mh = MH()
    def do(s): print s; print eval(s)
    do('mh.listfolders()')
    do('mh.listallfolders()')
    testfolders = ['@test', '@test/test1', '@test/test2',
                   '@test/test1/test11', '@test/test1/test12',
                   '@test/test1/test11/test111']
    for t in testfolders: do('mh.makefolder(%r)' % (t,))
    do('mh.listsubfolders(\'@test\')')
    do('mh.listallsubfolders(\'@test\')')
    f = mh.openfolder('@test')
    do('f.listsubfolders()')
    do('f.listallsubfolders()')
    do('f.getsequences()')
    seqs = f.getsequences()
    seqs['foo'] = IntSet('1-10 12-20', ' ').tolist()
    print seqs
    f.putsequences(seqs)
    do('f.getsequences()')
    for t in reversed(testfolders): do('mh.deletefolder(%r)' % (t,))
    do('mh.getcontext()')
    context = mh.getcontext()
    f = mh.openfolder(context)
    do('f.getcurrent()')
    for seq in ('first', 'last', 'cur', '.', 'prev', 'next',
                'first:3', 'last:3', 'cur:3', 'cur:-3',
                'prev:3', 'next:3',
                '1:3', '1:-3', '100:3', '100:-3', '10000:3', '10000:-3',
                'all'):
        try:
            do('f.parsesequence(%r)' % (seq,))
        except Error, msg:
            print "Error:", msg
        stuff = os.popen("pick %r 2>/dev/null" % (seq,)).read()
        list = map(int, stuff.split())
        print list, "<-- pick" 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:41,代碼來源:mhlib.py


注:本文中的mhlib.MH屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。