jenkins-bot has submitted this change and it was merged.
Change subject: Fixed print statements ......................................................................
Fixed print statements
Change-Id: Ia0edaf1b30b27d424d2b3fc2fd0fd827947dd72d --- M pywikibot/config2.py M pywikibot/date.py M pywikibot/pagegenerators.py M pywikibot/textlib.py M pywikibot/userinterfaces/terminal_interface_base.py M pywikibot/userinterfaces/win32_unicode.py 6 files changed, 23 insertions(+), 24 deletions(-)
Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/config2.py b/pywikibot/config2.py index 9f586c3..003c6e4 100644 --- a/pywikibot/config2.py +++ b/pywikibot/config2.py @@ -674,11 +674,11 @@ if __sys.platform == 'win32' or _filemode & 0o02 == 0 or True: exec(compile(open(_filename).read(), _filename, 'exec')) else: - print "WARNING: Skipped '%(fn)s': writeable by others." \ - % {'fn': _filename} + print("WARNING: Skipped '%(fn)s': writeable by others." \ + % {'fn': _filename}) else: - print "WARNING: Skipped '%(fn)s': owned by someone else." \ - % {'fn': _filename} + print("WARNING: Skipped '%(fn)s': owned by someone else." \ + % {'fn': _filename})
# Test for obsoleted and/or unknown variables. for _key, _val in globals().items(): @@ -696,14 +696,14 @@ elif ot is int and (nt is float or nt is bool): pass else: - print "WARNING: Type of '%(_key)s' changed" % locals() - print " %(was)s: %(old)s" % {'was': "Was", 'old': ot} - print " %(now)s: %(new)s" % {'now': "Now", 'new': nt} + print("WARNING: Type of '%(_key)s' changed" % locals()) + print(" %(was)s: %(old)s" % {'was': "Was", 'old': ot}) + print(" %(now)s: %(new)s" % {'now': "Now", 'new': nt}) del nt, ot else: - print("WARNING: " + print(("WARNING: " "Configuration variable %(_key)r is defined but unknown.\n" - "Misspelled?" % locals()) + "Misspelled?" % locals()))
# Fix up default console_encoding if console_encoding is None: @@ -739,7 +739,7 @@ if _arg == "modified": _all = 0 else: - print "Unknown arg %(_arg)s ignored" % locals() + print("Unknown arg %(_arg)s ignored" % locals()) _k = globals().keys() _k.sort() for _name in _k: @@ -747,7 +747,7 @@ if not type(globals()[_name]) in [types.FunctionType, types.ModuleType]: if _all or _glv[_name] != globals()[_name]: - print _name, "=", repr(globals()[_name]) + print(_name, "=", repr(globals()[_name]))
# cleanup all locally-defined variables for __var in globals().keys(): diff --git a/pywikibot/date.py b/pywikibot/date.py index 410540d..46ccb54 100644 --- a/pywikibot/date.py +++ b/pywikibot/date.py @@ -2349,8 +2349,8 @@ if value is not None: start, stop = value, value + 1 if showAll: - print(u"Processing %s with limits from %d to %d and step %d" - % (formatName, start, stop - 1, step)) + pywikibot.output((u"Processing %s with limits from %d to %d and step %d" + % (formatName, start, stop - 1, step)))
for code, convFunc in formats[formatName].iteritems(): ## import time @@ -2366,12 +2366,12 @@ " %s != %s: assert failed, values didn't match" % (newValue, value)) if showAll: - print(u"date.formats['%s']['%s'](%d): '%s' -> %d" - % (formatName, code, value, convFunc(value), - newValue)) + pywikibot.output((u"date.formats['%s']['%s'](%d): '%s' -> %d" + % (formatName, code, value, convFunc(value), + newValue))) except: - print(u"********** Error in date.formats['%s']['%s'](%d)" - % (formatName, code, value)) + pywikibot.output((u"********** Error in date.formats['%s']['%s'](%d)" + % (formatName, code, value))) raise ## print(u"%s\t%s\t%f" % (formatName, code, time.clock() - startClock))
@@ -2393,7 +2393,7 @@ else: # Extensive test! Test decade rounding testMapEntry(formatName, showAll) - print(u"'%s' complete." % formatName) + pywikibot.output((u"'%s' complete." % formatName)) if quick: ## print(u'Date module quick consistency test passed') pass diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py index 4033f68..0a9d2ae 100644 --- a/pywikibot/pagegenerators.py +++ b/pywikibot/pagegenerators.py @@ -1256,7 +1256,6 @@ while True: try: namespaceNumber, pageName = cursor.fetchone() - print namespaceNumber, pageName except TypeError: # Limit reached or no more results break diff --git a/pywikibot/textlib.py b/pywikibot/textlib.py index 80ddf86..4459b1c 100644 --- a/pywikibot/textlib.py +++ b/pywikibot/textlib.py @@ -231,8 +231,8 @@ match.group(groupID) + \ replacement[groupMatch.end():]) except IndexError: - print '\nInvalid group reference:', groupID - print 'Groups found:\n', match.groups() + pywikibot.output('\nInvalid group reference: %s' % groupID) + pywikibot.output('Groups found:\n%s' % match.groups()) raise IndexError text = text[:match.start()] + replacement + text[match.end():]
diff --git a/pywikibot/userinterfaces/terminal_interface_base.py b/pywikibot/userinterfaces/terminal_interface_base.py index 60ca7b9..9b1a656 100755 --- a/pywikibot/userinterfaces/terminal_interface_base.py +++ b/pywikibot/userinterfaces/terminal_interface_base.py @@ -238,7 +238,7 @@ try: import gui except ImportError as e: - print 'Could not load GUI modules: %s' % e + print('Could not load GUI modules: %s' % e) return text editor = gui.EditBoxWindow() return editor.edit(text, jumpIndex=jumpIndex, highlight=highlight) diff --git a/pywikibot/userinterfaces/win32_unicode.py b/pywikibot/userinterfaces/win32_unicode.py index b06025a..97a611a 100755 --- a/pywikibot/userinterfaces/win32_unicode.py +++ b/pywikibot/userinterfaces/win32_unicode.py @@ -42,7 +42,7 @@ # So be paranoid about catching errors and reporting them to original_stderr, # so that we can at least see them. def _complain(message): - print >>original_stderr, isinstance(message, str) and message or repr(message) + print(isinstance(message, str) and message or repr(message), file=original_stderr)
# Work around http://bugs.python.org/issue6058. codecs.register(lambda name: name == 'cp65001' and codecs.lookup('utf-8') or None)
pywikibot-commits@lists.wikimedia.org