Created
March 27, 2020 22:04
-
-
Save aam/051f320185bd6eb991a1430a22e6999e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/clang-format-diff.py b/clang-format-diff.py | |
index ffa30e7..9c5bcc5 100755 | |
--- a/clang-format-diff.py | |
+++ b/clang-format-diff.py | |
@@ -27,7 +27,7 @@ import difflib | |
import re | |
import string | |
import subprocess | |
-import StringIO | |
+import io | |
import sys | |
@@ -89,9 +89,9 @@ def main(): | |
['-lines', str(start_line) + ':' + str(end_line)]) | |
# 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 = [args.binary, filename] | |
if args.i: | |
command.append('-i') | |
@@ -109,7 +109,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.StringIO(stdout).readlines() | |
diff = difflib.unified_diff(code, formatted_code, | |
filename, filename, | |
'(before formatting)', '(after formatting)') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment