tools: Use Python 3 style print statements [9/9]
Initial conversion performed using '2to3 -f print .'.
Imports added and duplicate parentheses removed manually.
Manually converted files, comments and inline code that 2to3 missed.
Afterwards ran "git cl format --python" and cherry-picked the formatting changes.
There are no intended behavioural changes.
Bug: 941669
Change-Id: Ib7b47c4294679b5091faf4b56486cd5946f78377
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1818520
Commit-Queue: Raul Tambre <[email protected]>
Auto-Submit: Raul Tambre <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Cr-Commit-Position: refs/heads/master@{#700582}
diff --git a/tools/unused-symbols-report.py b/tools/unused-symbols-report.py
index 993e436b..4376a5b 100755
--- a/tools/unused-symbols-report.py
+++ b/tools/unused-symbols-report.py
@@ -17,6 +17,8 @@
./tools/unused-symbols-report.py buildlog > report.html
"""
+from __future__ import print_function
+
import cgi
import optparse
import os
@@ -31,7 +33,7 @@
if cppfilt_proc is None:
cppfilt_proc = subprocess.Popen(['c++filt'], stdin=subprocess.PIPE,
stdout=subprocess.PIPE)
- print >>cppfilt_proc.stdin, sym
+ print(sym, file=cppfilt_proc.stdin)
return cppfilt_proc.stdout.readline().strip()
@@ -73,7 +75,7 @@
continue
match = path_re.match(path)
if not match:
- print >>sys.stderr, "Skipping weird path", path
+ print("Skipping weird path", path, file=sys.stderr)
continue
target, path = match.groups()
yield target, path, symbol
@@ -130,23 +132,23 @@
entries = targets.setdefault(target, [])
entries.append((symbol, path))
- print TEMPLATE_HEADER
- print "<p>jump to target:"
- print "<select onchange='document.location.hash = this.value'>"
+ print(TEMPLATE_HEADER)
+ print("<p>jump to target:")
+ print("<select onchange='document.location.hash = this.value'>")
for target in sorted(targets.keys()):
- print "<option>%s</option>" % target
- print "</select></p>"
+ print("<option>%s</option>" % target)
+ print("</select></p>")
for target in sorted(targets.keys()):
- print "<h2>%s" % target
- print "<a class=permalink href='#%s' name='%s'>#</a>" % (target, target)
- print "</h2>"
- print "<table width=100% cellspacing=0>"
+ print("<h2>%s" % target)
+ print("<a class=permalink href='#%s' name='%s'>#</a>" % (target, target))
+ print("</h2>")
+ print("<table width=100% cellspacing=0>")
for symbol, path in sorted(targets[target]):
htmlsymbol = cgi.escape(symbol).replace('::', '::<wbr>')
- print "<tr><td><div class=symbol>%s</div></td>" % htmlsymbol
- print "<td valign=top><div class=file>%s</div></td></tr>" % path
- print "</table>"
+ print("<tr><td><div class=symbol>%s</div></td>" % htmlsymbol)
+ print("<td valign=top><div class=file>%s</div></td></tr>" % path)
+ print("</table>")
def main():