Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b1f0812

Browse files
committed
Piers' latest version, labeled 2.11. This time he integrated my
changes, and made only a few minor changes. No changes of my own this time.
1 parent 95e6f70 commit b1f0812

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

Lib/imaplib.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
"""IMAP4 client.
23
34
Based on RFC 2060.
@@ -13,10 +14,8 @@
1314
ParseFlags
1415
Time2Internaldate
1516
"""
16-
#
17-
# $Header$
18-
#
19-
__version__ = "$Revision$"
17+
18+
__version__ = "2.11"
2019

2120
import binascii, re, socket, string, time, random
2221

@@ -87,10 +86,10 @@ class IMAP4:
8786
name (in lower-case).
8887
8988
All arguments to commands are converted to strings, except for
90-
the last argument to APPEND which is passed as an IMAP4
91-
literal. If necessary (the string contains white-space and
92-
isn't enclosed with either parentheses or double quotes) each
93-
string is quoted.
89+
AUTHENTICATE, and the last argument to APPEND which is passed as
90+
an IMAP4 literal. If necessary (the string contains
91+
white-space and isn't enclosed with either parentheses or
92+
double quotes) each string is quoted.
9493
9594
Each command returns a tuple: (type, [data, ...]) where 'type'
9695
is usually 'OK' or 'NO', and 'data' is either the text from the
@@ -157,14 +156,13 @@ def __init__(self, host = '', port = IMAP4_PORT):
157156
if __debug__ and self.debug >= 3:
158157
print '\tCAPABILITIES: %s' % `self.capabilities`
159158

160-
self.PROTOCOL_VERSION = None
161159
for version in AllowedVersions:
162160
if not version in self.capabilities:
163161
continue
164162
self.PROTOCOL_VERSION = version
165-
break
166-
if not self.PROTOCOL_VERSION:
167-
raise self.error('server not IMAP4 compliant')
163+
return
164+
165+
raise self.error('server not IMAP4 compliant')
168166

169167

170168
def open(self, host, port):
@@ -915,15 +913,13 @@ def _trunc(m, s):
915913

916914
if __debug__ and __name__ == '__main__':
917915

916+
import getpass, sys
917+
918918
host = ''
919-
import sys
920-
if sys.argv[1:]:
921-
host = sys.argv[1]
919+
if sys.argv[1:]: host = sys.argv[1]
922920

923-
import getpass
924921
USER = getpass.getuser()
925-
PASSWD = getpass.getpass(
926-
"IMAP password for %s: " % (host or "localhost"))
922+
PASSWD = getpass.getpass("IMAP password for %s: " % (host or "localhost"))
927923

928924
test_seq1 = (
929925
('login', (USER, PASSWD)),

0 commit comments

Comments
 (0)