Module ImportFrom alias Expr Str Assign NameStore TupleLoad Str Str Str Str Assign NameStore Dict Str Str ListLoad Dict Str Str Str Str Str SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Str Dict Str Str Str Str Str SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Str Dict Str Str Str Str Str SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Str ListLoad Dict Str Str Str Str Str SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Str Assign NameStore Dict Str Str Dict Str Str TupleLoad Num Num Num TupleLoad Num Num Num Dict Str TupleLoad Num ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Pass decorator_list FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return TupleLoad Str ListComp BinOpMod Str NameLoad comprehension NameStore AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Assign AttributeStore NameLoad attr NameLoad Expr Str Assign AttributeStore NameLoad attr NameLoad Return TupleLoad Str TupleLoad Call NameLoad SubscriptLoad NameLoad Index AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str If CompareEq NameLoad Str body Return Call AttributeLoad NameLoad attr NameLoad orelse If CompareEq NameLoad Str body Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return TupleLoad Str TupleLoad Call AttributeLoad Str attr ListComp Call NameLoad SubscriptLoad NameLoad Index Str comprehension NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body TryExcept body Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index BinOpSub NameLoad Num Assign NameStore NameLoad handlers ExceptHandler type NameLoad body For TupleStore NameStore NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr body If CompareEq SubscriptLoad NameLoad Index Str NameLoad body Assign NameStore NameLoad Assign NameStore BinOpAdd NameLoad Num Break Assign NameStore Str If CompareIn NameLoad TupleLoad Str Str body Assign NameStore Str Return TupleLoad Str TupleLoad TupleLoad BinOpMod Str NameLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index Str decorator_list FunctionDef arguments args NameParam NameParam defaults body If Call AttributeLoad Call AttributeLoad NameLoad attr attr body Return ListLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index BinOpSub Call NameLoad Call AttributeLoad NameLoad attr Num orelse If Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Slice Num Num attr attr body Return ListLoad SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index BinOpSub Call NameLoad Call AttributeLoad SubscriptLoad NameLoad Slice Num Num attr Num orelse If Call AttributeLoad Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Slice Num Num attr Str Str attr attr body For NameStore SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr body If CompareEq SubscriptLoad NameLoad Index Str Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Slice Num Num attr Str Str attr body Return ListLoad NameLoad Assign NameStore ListLoad TryExcept body For NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index NameLoad body TryExcept body Assign SubscriptStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index BinOpSub NameLoad Num Index Str NameLoad Expr Call AttributeLoad NameLoad attr SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index BinOpSub NameLoad Num handlers ExceptHandler type NameLoad body For TupleStore NameStore NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr body If CompareEq SubscriptLoad NameLoad Index Str NameLoad body Assign SubscriptStore NameLoad Index Str BinOpAdd NameLoad Num Expr Call AttributeLoad NameLoad attr NameLoad Break ExceptHandler type NameLoad body Pass Return NameLoad handlers ExceptHandler type NameLoad body Raise Call NameLoad BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults Dict Dict body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If UnaryOpNot NameLoad body For NameStore NameLoad body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad ListLoad For NameStore SubscriptLoad NameLoad Index NameLoad body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr Call AttributeLoad NameLoad attr If UnaryOpNot NameLoad body For NameStore NameLoad body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad Call AttributeLoad SubscriptLoad NameLoad Index NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad Str attr ListComp Call NameLoad SubscriptLoad NameLoad Index Str comprehension NameStore NameLoad Return TupleLoad Str TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad Index Num TryExcept body Assign NameStore BinOpAdd Call NameLoad SubscriptLoad NameLoad Index Str Num handlers ExceptHandler type NameLoad body Assign NameStore ListLoad For NameStore Call AttributeLoad AttributeLoad NameLoad attr attr body For NameStore SubscriptLoad AttributeLoad NameLoad attr Index NameLoad body TryExcept body Expr Call AttributeLoad NameLoad attr Call NameLoad SubscriptLoad NameLoad Index Str handlers ExceptHandler body Pass If CompareGt Call NameLoad NameLoad Num body Assign NameStore BinOpAdd Call NameLoad NameLoad Num orelse Assign NameStore Num Assign NameStore BinOpAdd Str NameLoad Assign NameStore Dict Str Str Str Str Call NameLoad NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index NameLoad attr NameLoad Return TupleLoad Str BinOpMod Str NameLoad decorator_list FunctionDef arguments args NameParam defaults vararg body Expr Str Assign NameStore SubscriptLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr Index Call NameLoad BinOpSub SubscriptLoad NameLoad Index Num Num Assign NameStore Call NameLoad SubscriptLoad NameLoad Index Str Assign NameStore Call NameLoad BinOpAdd Str SubscriptLoad NameLoad Index Num If Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str body Assign SubscriptStore NameLoad Index Str BinOpMod Str Call AttributeLoad Str attr Call NameLoad BinOpAdd NameLoad NameLoad orelse If Call AttributeLoad Call AttributeLoad SubscriptLoad NameLoad Index Num attr attr Str body Assign SubscriptStore NameLoad Index Str BinOpMod Str Call AttributeLoad Str attr ListComp NameLoad comprehension NameStore NameLoad UnaryOpNot CompareIn NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str For TupleStore NameStore NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr body If CompareIn Str SubscriptLoad NameLoad Index Str body Expr Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad NameLoad attr attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body Return Call NameLoad decorator_list decorator_list Assign NameStore NameLoad
N/A imaplib ParseFlags N/A 
mockimaplib allows you to test applications connecting to a dummy imap
service. For more details on the api subset implemented,
refer to the imaplib docs.

The client should configure a dictionary to map imap string queries to sets
of entries stored in a message dummy storage dictionary. The module includes
a small set of default message records (SPAM and MESSAGES), two mailboxes
(Draft and INBOX) and a list of query/resultset entries (RESULTS).

Usage:

>>> import mockimaplib
>>> connection = mockimaplib.IMAP4_SSL(<host>)
>>> connection.login(<user>, <password>)
None
>>> connection.select("INBOX")
("OK", ... <mailbox length>)
# fetch commands specifying single uid or message id
# will try to get messages recorded in SPAM
>>> connection.uid(...)
<search query or fetch result>
# returns a string list of matching message ids
>>> connection.search(<query>)
("OK", ... "1 2 ... n")
 N/A MESSAGES N/A MIME-Version: 1.0
Received: by 10.140.91.199 with HTTP; Mon, 27 Jan 2014 13:52:30 -0800 (PST)
Date: Mon, 27 Jan 2014 19:52:30 -0200
Delivered-To: nurse@example.com
Message-ID: <10101010101010010000010101010001010101001010010000001@mail.example.com>
Subject: spam1
From: Mr. Gumby <gumby@example.com>
To: The nurse <nurse@example.com>
Content-Type: text/plain; charset=ISO-8859-1

Nurse!


 MIME-Version: 1.0
Received: by 10.140.91.199 with HTTP; Mon, 27 Jan 2014 13:52:47 -0800 (PST)
Date: Mon, 27 Jan 2014 19:52:47 -0200
Delivered-To: nurse@example.com
Message-ID: <101010101010100100000101010100010101010010100100000010@mail.example.com>
Subject: spam2
From: Mr. Gumby <gumby@example.com>
To: The nurse <nurse@example.com>
Content-Type: text/plain; charset=ISO-8859-1

Nurse, nurse! MIME-Version: 1.0
Received: by 10.140.91.199 with HTTP; Mon, 27 Jan 2014 13:54:54 -0800 (PST)
Date: Mon, 27 Jan 2014 19:54:54 -0200
Delivered-To: nurse@example.com
Message-ID: <1010101010101001000001010101000101010100101001000000101@mail.example.com>
Subject: spamalot1
From: Mr. Gumby <gumby@example.com>
To: The nurse <nurse@example.com>
Content-Type: text/plain; charset=ISO-8859-1

Nurse!


 MIME-Version: 1.0

Received: by 10.140.91.199 with HTTP; Mon, 27 Jan 2014 13:54:54 -0800 (PST)
Date: Mon, 27 Jan 2014 19:54:54 -0200
Delivered-To: nurse@example.com
Message-ID: <101010101010100100000101010100010101010010100100000010101@mail.example.com>
Subject: spamalot2
From: Mr. Gumby <gumby@example.com>
To: The nurse <nurse@example.com>
Content-Type: text/plain; charset=ISO-8859-1

Nurse! ... Nurse! ... Nurse!


 N/A SPAM N/A INBOX Draft N/A N/A uid headers complete flags 483209 N/A MESSAGES N/A 0 N/A MESSAGES N/A 0 N/A uid headers complete flags 483211 N/A MESSAGES N/A 1 N/A MESSAGES N/A 1 N/A uid headers complete flags 483225 N/A MESSAGES N/A 2 N/A MESSAGES N/A 2 N/A N/A uid headers complete flags 483432 N/A MESSAGES N/A 3 N/A MESSAGES N/A 3 N/A RESULTS N/A INBOX Draft N/A (ALL) (1:3) N/A 1 2 3 N/A 1 2 3 N/A (1:1) N/A 1 Connection N/A object N/A N/A Dummy connection object for the imap client.
    By default, uses the module SPAM and RESULT
    sets (use Connection.setup for custom values) login N/A N/A self user password N/A N/A N/A N/A __init__ N/A N/A self N/A N/A N/A N/A self _readonly False N/A N/A self _mailbox None N/A N/A N/A self setup N/A list N/A N/A self N/A N/A N/A N/A OK N/A N/A (\HasNoChildren) "/" "%s" key N/A key N/A self spam N/A select N/A N/A self tablename readonly N/A False N/A N/A N/A self _readonly readonly N/A args: mailbox, boolean
        result[1][0] -> int last message id / mailbox lenght
        result[0] = 'OK'
         N/A N/A self _mailbox tablename N/A N/A OK N/A N/A len N/A SPAM N/A N/A self _mailbox None N/A uid N/A N/A self command uid arg N/A N/A N/A  args:
              command: "search" | "fetch"
              uid: None | uid
              parts: "(ALL)" | "(RFC822 FLAGS)" | "(RFC822.HEADER FLAGS)"

        "search", None, "(ALL)" -> ("OK", ("uid_1 uid_2 ... uid_<mailbox length>", None))
        "search", None, "<query>" -> ("OK", ("uid_1 uid_2 ... uid_n", None))
        "fetch", uid, parts -> ("OK", (("<id> ...", "<raw message as specified in parts>"), "<flags>")
                                [0]     [1][0][0]     [1][0][1]                              [1][1]
         N/A N/A command search N/A N/A N/A N/A self _search arg N/A N/A N/A command fetch N/A N/A N/A N/A self _fetch uid arg N/A _search N/A N/A self query N/A N/A N/A N/A OK N/A N/A N/A join N/A N/A str N/A item N/A uid N/A item N/A N/A self _get_messages query None N/A _fetch N/A N/A self value arg N/A N/A N/A N/A N/A message N/A N/A N/A self spam N/A N/A self _mailbox N/A N/A value 1 N/A message_id value N/A N/A N/A TypeError N/A N/A N/A x item N/A enumerate N/A N/A self spam N/A N/A self _mailbox N/A N/A N/A N/A item N/A uid value N/A N/A message item N/A message_id N/A x 1 N/A N/A parts headers N/A N/A arg N/A (ALL) (RFC822 FLAGS) N/A N/A parts complete N/A N/A OK N/A N/A N/A %s  message_id N/A message N/A parts N/A message N/A flags N/A _get_messages N/A N/A self query N/A N/A N/A N/A N/A N/A N/A query strip isdigit N/A N/A N/A N/A N/A N/A self spam N/A N/A self _mailbox N/A N/A N/A int N/A N/A query strip 1 N/A N/A N/A N/A N/A N/A N/A query N/A 1 -1 strip isdigit N/A N/A N/A N/A N/A N/A self spam N/A N/A self _mailbox N/A N/A N/A int N/A N/A N/A query N/A 1 -1 strip 1 N/A N/A N/A N/A N/A N/A N/A N/A N/A query N/A 1 -1 replace UID strip isdigit N/A N/A item N/A N/A self spam N/A N/A self _mailbox N/A N/A N/A N/A item N/A uid N/A N/A N/A N/A N/A query N/A 1 -1 replace UID strip N/A N/A N/A item N/A messages N/A N/A N/A N/A m N/A N/A N/A self results N/A N/A self _mailbox N/A query N/A N/A N/A N/A N/A N/A N/A N/A self spam N/A N/A self _mailbox N/A N/A m 1 N/A id m N/A N/A N/A messages append N/A N/A N/A self spam N/A N/A self _mailbox N/A N/A m 1 N/A N/A N/A TypeError N/A N/A N/A x item N/A enumerate N/A N/A self spam N/A N/A self _mailbox N/A N/A N/A N/A item N/A uid m N/A N/A N/A item N/A id N/A x 1 N/A N/A N/A messages append item N/A N/A N/A IndexError N/A N/A N/A messages N/A N/A N/A KeyError N/A N/A N/A ValueError N/A The client issued an unexpected query: %s query N/A setup N/A N/A self spam results N/A N/A N/A N/A N/A adds custom message and query databases or sets
        the values to the module defaults.
         N/A N/A self spam spam N/A N/A self results results N/A N/A spam N/A N/A key SPAM N/A N/A N/A N/A self spam N/A key N/A N/A d N/A SPAM N/A key N/A N/A N/A N/A N/A N/A self spam N/A key append N/A N/A d copy N/A N/A results N/A N/A key RESULTS N/A N/A N/A N/A self results N/A key N/A N/A N/A RESULTS N/A key copy N/A search N/A N/A self first query N/A N/A N/A  args:
             first: None
             query: string with mailbox query (flags, date, uid, id, ...)
                example: '2:15723 BEFORE 27-Jan-2014 FROM "gumby"'
        result[1][0] -> "id_1 id_2 ... id_n"
         N/A messages N/A N/A self _get_messages query N/A ids N/A N/A join N/A N/A str N/A item N/A id N/A item messages N/A N/A OK N/A ids None N/A append N/A N/A self mailbox flags struct_time message N/A N/A N/A 
            result, data = self.connection.append(mailbox, flags, struct_time, message)
            if result == "OK":
                uid = int(re.findall("\d+", str(data))[-1])
         N/A last N/A N/A N/A self spam N/A mailbox N/A -1 N/A N/A N/A uid N/A N/A int N/A last N/A uid 1 N/A N/A N/A ValueError N/A N/A alluids N/A N/A _mailbox N/A N/A N/A self spam keys N/A N/A item N/A N/A self spam N/A _mailbox N/A N/A N/A N/A N/A N/A alluids append N/A int N/A item N/A uid N/A N/A N/A N/A N/A N/A N/A len alluids 0 N/A N/A uid N/A N/A max alluids 1 N/A N/A uid 1 N/A flags N/A FLAGS  flags N/A item N/A uid headers complete flags N/A str uid message message flags N/A N/A N/A N/A N/A self spam N/A mailbox append item N/A N/A OK N/A spam spam %s spam uid N/A store N/A N/A self N/A args N/A N/A 
        implements some flag commands
        args: ("<id>", "<+|->FLAGS", "(\Flag1 \Flag2 ... \Flagn)")
         N/A message N/A N/A N/A self spam N/A N/A self _mailbox N/A N/A int N/A N/A args N/A 0 1 N/A old_flags N/A ParseFlags N/A message N/A flags N/A flags N/A ParseFlags N/A FLAGS N/A args N/A 2 N/A N/A N/A N/A N/A N/A args N/A 1 strip startswith + N/A N/A N/A message N/A flags N/A FLAGS (%s) N/A N/A join N/A set N/A flags old_flags N/A N/A N/A N/A N/A N/A N/A args N/A 1 strip startswith - N/A N/A N/A message N/A flags N/A FLAGS (%s) N/A N/A join N/A flag N/A flag old_flags N/A N/A flag flags N/A expunge N/A N/A self N/A N/A N/A implements removal of deleted flag messages N/A N/A x item N/A enumerate N/A N/A self spam N/A N/A self _mailbox N/A N/A N/A \Deleted N/A item N/A flags N/A N/A N/A N/A N/A N/A self spam N/A N/A self _mailbox pop x N/A N/A IMAP4 N/A object N/A N/A >>> connection = IMAP4() # creates the dummy imap4 client object __new__ N/A N/A self N/A args kwargs N/A N/A N/A Connection N/A N/A N/A IMAP4_SSL IMAP4