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.)
This commit is contained in:
Guido van Rossum 2007-02-09 05:37:30 +00:00
parent 452bf519a7
commit be19ed77dd
331 changed files with 2567 additions and 2648 deletions

View file

@ -809,11 +809,11 @@ class TestXMLParser(XMLParser):
def handle_xml(self, encoding, standalone):
self.flush()
print 'xml: encoding =',encoding,'standalone =',standalone
print('xml: encoding =',encoding,'standalone =',standalone)
def handle_doctype(self, tag, pubid, syslit, data):
self.flush()
print 'DOCTYPE:',tag, repr(data)
print('DOCTYPE:',tag, repr(data))
def handle_data(self, data):
self.testdata = self.testdata + data
@ -824,47 +824,47 @@ class TestXMLParser(XMLParser):
data = self.testdata
if data:
self.testdata = ""
print 'data:', repr(data)
print('data:', repr(data))
def handle_cdata(self, data):
self.flush()
print 'cdata:', repr(data)
print('cdata:', repr(data))
def handle_proc(self, name, data):
self.flush()
print 'processing:',name,repr(data)
print('processing:',name,repr(data))
def handle_comment(self, data):
self.flush()
r = repr(data)
if len(r) > 68:
r = r[:32] + '...' + r[-32:]
print 'comment:', r
print('comment:', r)
def syntax_error(self, message):
print 'error at line %d:' % self.lineno, message
print('error at line %d:' % self.lineno, message)
def unknown_starttag(self, tag, attrs):
self.flush()
if not attrs:
print 'start tag: <' + tag + '>'
print('start tag: <' + tag + '>')
else:
print 'start tag: <' + tag,
print('start tag: <' + tag, end=' ')
for name, value in attrs.items():
print name + '=' + '"' + value + '"',
print '>'
print(name + '=' + '"' + value + '"', end=' ')
print('>')
def unknown_endtag(self, tag):
self.flush()
print 'end tag: </' + tag + '>'
print('end tag: </' + tag + '>')
def unknown_entityref(self, ref):
self.flush()
print '*** unknown entity ref: &' + ref + ';'
print('*** unknown entity ref: &' + ref + ';')
def unknown_charref(self, ref):
self.flush()
print '*** unknown char ref: &#' + ref + ';'
print('*** unknown char ref: &#' + ref + ';')
def close(self):
XMLParser.close(self)
@ -897,7 +897,7 @@ def test(args = None):
try:
f = open(file, 'r')
except IOError as msg:
print file, ":", msg
print(file, ":", msg)
sys.exit(1)
data = f.read()
@ -916,13 +916,13 @@ def test(args = None):
x.close()
except Error as msg:
t1 = time()
print msg
print(msg)
if do_time:
print 'total time: %g' % (t1-t0)
print('total time: %g' % (t1-t0))
sys.exit(1)
t1 = time()
if do_time:
print 'total time: %g' % (t1-t0)
print('total time: %g' % (t1-t0))
if __name__ == '__main__':