MCPcopy Index your code
hub / github.com/python/cpython / select

Method select

Lib/imaplib.py:840–869  ·  view source on GitHub ↗

Select a mailbox. Flush all untagged responses. (typ, [data]) = .select(mailbox='INBOX', readonly=False) 'data' is count of messages in mailbox ('EXISTS' response). Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so other res

(self, mailbox='INBOX', readonly=False)

Source from the content-addressed store, hash-verified

838
839
840 def select(self, mailbox='INBOX', readonly=False):
841 """Select a mailbox.
842
843 Flush all untagged responses.
844
845 (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=False)
846
847 'data' is count of messages in mailbox ('EXISTS' response).
848
849 Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so
850 other responses should be obtained via <instance>.response('FLAGS') etc.
851 """
852 self.untagged_responses = {} # Flush old responses.
853 self.is_readonly = readonly
854 if readonly:
855 name = 'EXAMINE'
856 else:
857 name = 'SELECT'
858 typ, dat = self._simple_command(name, mailbox)
859 if typ != 'OK':
860 self.state = 'AUTH' # Might have been 'SELECTED'
861 return typ, dat
862 self.state = 'SELECTED'
863 if 'READ-ONLY' in self.untagged_responses \
864 and not readonly:
865 if __debug__:
866 if self.debug >= 1:
867 self._dump_ur(self.untagged_responses)
868 raise self.readonly('%s is not writable' % mailbox)
869 return typ, self.untagged_responses.get('EXISTS', [None])
870
871
872 def setacl(self, mailbox, who, what):

Callers 5

serve_until_quitMethod · 0.45
_communicateMethod · 0.45
_readlineMethod · 0.45
serve_foreverMethod · 0.45
handle_requestMethod · 0.45

Calls 4

_simple_commandMethod · 0.95
_dump_urMethod · 0.95
readonlyMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected