本文整理匯總了Python中mailpile.Mailpile.search方法的典型用法代碼示例。如果您正苦於以下問題:Python Mailpile.search方法的具體用法?Python Mailpile.search怎麽用?Python Mailpile.search使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mailpile.Mailpile
的用法示例。
在下文中一共展示了Mailpile.search方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: in
# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import search [as 別名]
mp._config.index.load()
# Rescan AGAIN, so we can test for the presence of duplicates.
mp.rescan()
# Search for things, there should be exactly one match for each.
mp.order('flat-date')
for search in (['from:wow'],
['agirorn'],
['subject:emerging'],
['from:twitter', 'brennan'],
['dates:2013-09-17', 'feministinn'],
['att:jpg', 'fimmtudaginn'],
['subject:Moderation', 'kde-isl']):
say('Searching for: %s' % search)
results = mp.search(*search)
assert(len(results.result) == 1)
assert(results.result[0]['count'] == 1)
say("Tests passed, woot!")
except:
say("Tests FAILED!")
print
traceback.print_exc()
##[ Interactive mode ]########################################################
if '-i' in sys.argv:
import code
import readline
示例2: say
# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import search [as 別名]
['subject:Moderation', 'kde-isl'],
['from:bjarni', 'subject:testing', 'subject:encryption',
'should', 'encrypted', 'message', 'tag:mp_enc-decrypted'],
['from:bjarni', 'subject:inline', 'subject:encryption',
'grand', 'tag:mp_enc-mixed-decrypted'],
['from:bjarni', 'subject:signatures',
'tag:mp_sig-unverified'],
['from:brennan', 'subject:encrypted',
'testing', 'purposes', 'only', 'tag:mp_enc-decrypted'],
['from:brennan', 'subject:signed',
'tag:mp_sig-unverified'],
['from:barnaby', 'subject:testing', 'soup',
'tag:mp_sig-unknown', 'tag:mp_enc-decrypted'],
):
say('Searching for: %s' % search)
results = mp.search(*search)
assert(results.result['stats']['count'] == 1)
say('Checking size of inbox')
mp.order('flat-date')
assert(mp.search('tag:inbox').result['stats']['count'] == 14)
say('FIXME: Make sure message signatures verified')
# Make sure we are decoding weird headers correctly
search_bre = mp.search(*FROM_BRE).result
result_bre = search_bre['data']['metadata'][search_bre['thread_ids'][0]]
view_bre = mp.view('=%s' % result_bre['mid']).result
metadata_bre = view_bre['data']['metadata'][view_bre['thread_ids'][0]]
message_bre = view_bre['data']['messages'][view_bre['thread_ids'][0]]
from_bre = search_bre['data']['addresses'][metadata_bre['from_aid']]
示例3: in
# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import search [as 別名]
# Rescan AGAIN, so we can test for the presence of duplicates.
mp.rescan()
# Search for things, there should be exactly one match for each.
mp.order('flat-date')
for search in (FROM_BRE,
['agirorn'],
['subject:emerging'],
['from:twitter', 'brennan'],
['dates:2013-09-17', 'feministinn'],
['mailbox:tests.mbx'] + FROM_BRE,
['att:jpg', 'fimmtudaginn'],
['subject:Moderation', 'kde-isl']):
say('Searching for: %s' % search)
results = mp.search(*search)
assert(results.result['count'] == 1)
# Make sure we are decoding weird headers correctly
result_bre = mp.search(*FROM_BRE).result['messages'][0]
result_bre = mp.view('=%s' % result_bre['mid']).result['messages'][0]
say('Checking encoding: %s' % result_bre['from'])
assert('=C3' not in result_bre['from'])
say('Checking encoding: %s' % result_bre['message']['headers']['To'])
assert('utf' not in result_bre['message']['headers']['To'])
# Create a message...
new_mid = mp.message_compose().result['messages'][0]['mid']
assert(mp.search('tag:drafts').result['count'] == 0)
assert(mp.search('tag:blank').result['count'] == 1)
assert(mp.search('tag:sent').result['count'] == 0)
示例4: say
# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import search [as 別名]
FROM_BRE,
["agirorn"],
["subject:emerging"],
["from:twitter", "brennan"],
["dates:2013-09-17", "feministinn"],
["mailbox:tests.mbx"] + FROM_BRE,
["att:jpg", "fimmtudaginn"],
["subject:Moderation", "kde-isl"],
["from:bjarni", "subject:testing", "subject:encryption", "should", "encrypted", "message"],
["from:bjarni", "subject:inline", "subject:encryption"],
["from:bjarni", "subject:signatures"],
["from:brennan", "subject:signed"],
["from:brennan", "subject:encrypted", "testing", "purposes", "only"],
):
say("Searching for: %s" % search)
results = mp.search(*search)
assert results.result["stats"]["count"] == 1
say("Checking size of inbox")
mp.order("flat-date")
assert mp.search("tag:inbox").result["stats"]["count"] == 13
say("FIXME: Make sure message signatures verified")
# Make sure we are decoding weird headers correctly
search_bre = mp.search(*FROM_BRE).result
result_bre = search_bre["data"]["metadata"][search_bre["thread_ids"][0]]
view_bre = mp.view("=%s" % result_bre["mid"]).result
metadata_bre = view_bre["data"]["metadata"][view_bre["thread_ids"][0]]
message_bre = view_bre["data"]["messages"][view_bre["thread_ids"][0]]
from_bre = search_bre["data"]["addresses"][metadata_bre["from_aid"]]
示例5: in
# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import search [as 別名]
# Rescan AGAIN, so we can test for the presence of duplicates.
mp.rescan()
# Search for things, there should be exactly one match for each.
mp.order('flat-date')
for search in (FROM_BRE,
['agirorn'],
['subject:emerging'],
['from:twitter', 'brennan'],
['dates:2013-09-17', 'feministinn'],
['mailbox:tests.mbx'] + FROM_BRE,
['att:jpg', 'fimmtudaginn'],
['subject:Moderation', 'kde-isl']):
say('Searching for: %s' % search)
results = mp.search(*search)
assert(len(results.result) == 1)
assert(results.result[0]['count'] == 1)
# Make sure we are decoding weird headers correctly
result_bre = mp.search(*FROM_BRE).result[0]['messages'][0]
result_bre = mp.view('=%s' % result_bre['mid']).result[0]['messages'][0]
say('Checking encoding: %s' % result_bre['from'])
assert('=C3' not in result_bre['from'])
say('Checking encoding: %s' % result_bre['message']['headers']['To'])
assert('utf' not in result_bre['message']['headers']['To'])
say("Tests passed, woot!")
except:
say("Tests FAILED!")
print
示例6: in
# 需要導入模塊: from mailpile import Mailpile [as 別名]
# 或者: from mailpile.Mailpile import search [as 別名]
mp._config.index.load()
# Rescan AGAIN, so we can test for the presence of duplicates.
mp.rescan()
# Search for things, there should be exactly one match for each.
mp.order('flat-date')
for search in (FROM_BRE,
['agirorn'],
['subject:emerging'],
['from:twitter', 'brennan'],
['dates:2013-09-17', 'feministinn'],
['att:jpg', 'fimmtudaginn'],
['subject:Moderation', 'kde-isl']):
say('Searching for: %s' % search)
results = mp.search(*search)
assert(len(results.result) == 1)
assert(results.result[0]['count'] == 1)
# Make sure we are decoding weird headers correctly
from_data = mp.search(*FROM_BRE).result[0]['messages'][0]['from']
say('Checking encoding: %s' % from_data)
assert('=C3' not in from_data)
say("Tests passed, woot!")
except:
say("Tests FAILED!")
print
traceback.print_exc()