From 8cf03bcdf5a62aea2bee0e5d9fb05ea88644c253 Mon Sep 17 00:00:00 2001 From: Nakul Joshi <3213360+nakulj@users.noreply.github.com> Date: Mon, 2 Aug 2021 13:07:28 -0700 Subject: [PATCH] Run 2to3 on google-java-format-diff.py --- scripts/google-java-format-diff.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/google-java-format-diff.py b/scripts/google-java-format-diff.py index 63685aac..cf2ded9e 100755 --- a/scripts/google-java-format-diff.py +++ b/scripts/google-java-format-diff.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python3 # #===- google-java-format-diff.py - google-java-format Diff Reformatter -----===# # @@ -31,7 +31,7 @@ import re import string import subprocess -import StringIO +import io import sys from distutils.spawn import find_executable @@ -109,9 +109,9 @@ def main(): base_command = [binary] # Reformat files containing changes in place. - for filename, lines in lines_by_file.iteritems(): + for filename, lines in lines_by_file.items(): if args.i and args.verbose: - print 'Formatting', filename + print('Formatting', filename) command = base_command[:] if args.i: command.append('-i') @@ -134,7 +134,7 @@ def main(): if not args.i: with open(filename) as f: code = f.readlines() - formatted_code = StringIO.StringIO(stdout).readlines() + formatted_code = io.StringIO(stdout).readlines() diff = difflib.unified_diff(code, formatted_code, filename, filename, '(before formatting)', '(after formatting)')