Skip to content

Commit 0051153

Browse files
nakuljgoogle-java-format Team
authored and
google-java-format Team
committed
Run 2to3 on google-java-format-diff.py
Fixes #640 COPYBARA_INTEGRATE_REVIEW=#640 from nakulj:py2to3 8cf03bc PiperOrigin-RevId: 388292852
1 parent f2eabaa commit 0051153

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: scripts/google-java-format-diff.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python2.7
1+
#!/usr/bin/env python3
22
#
33
#===- google-java-format-diff.py - google-java-format Diff Reformatter -----===#
44
#
@@ -31,7 +31,7 @@
3131
import re
3232
import string
3333
import subprocess
34-
import StringIO
34+
import io
3535
import sys
3636
from distutils.spawn import find_executable
3737

@@ -109,9 +109,9 @@ def main():
109109
base_command = [binary]
110110

111111
# Reformat files containing changes in place.
112-
for filename, lines in lines_by_file.iteritems():
112+
for filename, lines in lines_by_file.items():
113113
if args.i and args.verbose:
114-
print 'Formatting', filename
114+
print('Formatting', filename)
115115
command = base_command[:]
116116
if args.i:
117117
command.append('-i')
@@ -134,7 +134,7 @@ def main():
134134
if not args.i:
135135
with open(filename) as f:
136136
code = f.readlines()
137-
formatted_code = StringIO.StringIO(stdout).readlines()
137+
formatted_code = io.StringIO(stdout).readlines()
138138
diff = difflib.unified_diff(code, formatted_code,
139139
filename, filename,
140140
'(before formatting)', '(after formatting)')

0 commit comments

Comments
 (0)