mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
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:
parent
452bf519a7
commit
be19ed77dd
331 changed files with 2567 additions and 2648 deletions
|
|
@ -89,11 +89,11 @@ class ModuleFinder:
|
|||
def msg(self, level, str, *args):
|
||||
if level <= self.debug:
|
||||
for i in range(self.indent):
|
||||
print " ",
|
||||
print str,
|
||||
print(" ", end=' ')
|
||||
print(str, end=' ')
|
||||
for arg in args:
|
||||
print repr(arg),
|
||||
print
|
||||
print(repr(arg), end=' ')
|
||||
print()
|
||||
|
||||
def msgin(self, *args):
|
||||
level = args[0]
|
||||
|
|
@ -482,38 +482,38 @@ class ModuleFinder:
|
|||
"""Print a report to stdout, listing the found modules with their
|
||||
paths, as well as modules that are missing, or seem to be missing.
|
||||
"""
|
||||
print
|
||||
print " %-25s %s" % ("Name", "File")
|
||||
print " %-25s %s" % ("----", "----")
|
||||
print()
|
||||
print(" %-25s %s" % ("Name", "File"))
|
||||
print(" %-25s %s" % ("----", "----"))
|
||||
# Print modules found
|
||||
keys = self.modules.keys()
|
||||
keys.sort()
|
||||
for key in keys:
|
||||
m = self.modules[key]
|
||||
if m.__path__:
|
||||
print "P",
|
||||
print("P", end=' ')
|
||||
else:
|
||||
print "m",
|
||||
print "%-25s" % key, m.__file__ or ""
|
||||
print("m", end=' ')
|
||||
print("%-25s" % key, m.__file__ or "")
|
||||
|
||||
# Print missing modules
|
||||
missing, maybe = self.any_missing_maybe()
|
||||
if missing:
|
||||
print
|
||||
print "Missing modules:"
|
||||
print()
|
||||
print("Missing modules:")
|
||||
for name in missing:
|
||||
mods = self.badmodules[name].keys()
|
||||
mods.sort()
|
||||
print "?", name, "imported from", ', '.join(mods)
|
||||
print("?", name, "imported from", ', '.join(mods))
|
||||
# Print modules that may be missing, but then again, maybe not...
|
||||
if maybe:
|
||||
print
|
||||
print "Submodules thay appear to be missing, but could also be",
|
||||
print "global names in the parent package:"
|
||||
print()
|
||||
print("Submodules thay appear to be missing, but could also be", end=' ')
|
||||
print("global names in the parent package:")
|
||||
for name in maybe:
|
||||
mods = self.badmodules[name].keys()
|
||||
mods.sort()
|
||||
print "?", name, "imported from", ', '.join(mods)
|
||||
print("?", name, "imported from", ', '.join(mods))
|
||||
|
||||
def any_missing(self):
|
||||
"""Return a list of modules that appear to be missing. Use
|
||||
|
|
@ -603,7 +603,7 @@ def test():
|
|||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "dmp:qx:")
|
||||
except getopt.error as msg:
|
||||
print msg
|
||||
print(msg)
|
||||
return
|
||||
|
||||
# Process options
|
||||
|
|
@ -634,9 +634,9 @@ def test():
|
|||
path[0] = os.path.dirname(script)
|
||||
path = addpath + path
|
||||
if debug > 1:
|
||||
print "path:"
|
||||
print("path:")
|
||||
for item in path:
|
||||
print " ", repr(item)
|
||||
print(" ", repr(item))
|
||||
|
||||
# Create the module finder and turn its crank
|
||||
mf = ModuleFinder(path, debug, exclude)
|
||||
|
|
@ -660,4 +660,4 @@ if __name__ == '__main__':
|
|||
try:
|
||||
mf = test()
|
||||
except KeyboardInterrupt:
|
||||
print "\n[interrupt]"
|
||||
print("\n[interrupt]")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue