Fix most trivially-findable print statements.
There's one major and one minor category still unfixed:
doctests are the major category (and I hope to be able to augment the
refactoring tool to refactor bona fide doctests soon);
other code generating print statements in strings is the minor category.
(Oh, and I don't know if the compiler package works.)
diff --git a/Lib/poplib.py b/Lib/poplib.py
index b7a7a8a..adf784f 100644
--- a/Lib/poplib.py
+++ b/Lib/poplib.py
@@ -100,14 +100,14 @@
def _putline(self, line):
- if self._debugging > 1: print '*put*', repr(line)
+ if self._debugging > 1: print('*put*', repr(line))
self.sock.sendall('%s%s' % (line, CRLF))
# Internal: send one command to the server (through _putline())
def _putcmd(self, line):
- if self._debugging: print '*cmd*', repr(line)
+ if self._debugging: print('*cmd*', repr(line))
self._putline(line)
@@ -117,7 +117,7 @@
def _getline(self):
line = self.file.readline()
- if self._debugging > 1: print '*get*', repr(line)
+ if self._debugging > 1: print('*get*', repr(line))
if not line: raise error_proto('-ERR EOF')
octets = len(line)
# server can send any combination of CR & LF
@@ -135,7 +135,7 @@
def _getresp(self):
resp, o = self._getline()
- if self._debugging > 1: print '*resp*', repr(resp)
+ if self._debugging > 1: print('*resp*', repr(resp))
c = resp[:1]
if c != '+':
raise error_proto(resp)
@@ -209,7 +209,7 @@
"""
retval = self._shortcmd('STAT')
rets = retval.split()
- if self._debugging: print '*stat*', repr(rets)
+ if self._debugging: print('*stat*', repr(rets))
numMessages = int(rets[1])
sizeMessages = int(rets[2])
return (numMessages, sizeMessages)
@@ -375,7 +375,7 @@
match = renewline.match(self.buffer)
line = match.group(0)
self.buffer = renewline.sub('' ,self.buffer, 1)
- if self._debugging > 1: print '*get*', repr(line)
+ if self._debugging > 1: print('*get*', repr(line))
octets = len(line)
if line[-2:] == CRLF:
@@ -385,7 +385,7 @@
return line[:-1], octets
def _putline(self, line):
- if self._debugging > 1: print '*put*', repr(line)
+ if self._debugging > 1: print('*put*', repr(line))
line += CRLF
bytes = len(line)
while bytes > 0:
@@ -409,15 +409,15 @@
if __name__ == "__main__":
import sys
a = POP3(sys.argv[1])
- print a.getwelcome()
+ print(a.getwelcome())
a.user(sys.argv[2])
a.pass_(sys.argv[3])
a.list()
(numMsgs, totalSize) = a.stat()
for i in range(1, numMsgs + 1):
(header, msg, octets) = a.retr(i)
- print "Message %d:" % i
+ print("Message %d:" % i)
for line in msg:
- print ' ' + line
- print '-----------------------'
+ print(' ' + line)
+ print('-----------------------')
a.quit()