Switch to using six (#1189)

With the Python 2.7 deadline fast approaching, modernize the codebase
making use of the modernize module to switch to using six, as well as
other upcoming features, such as absolute imports . Stop using 2to3
for Travis, yay!
This commit is contained in:
Steve Kowalik
2019-08-05 14:06:19 +10:00
committed by GitHub
parent f1ae7200ba
commit dc2f2ad8cb
182 changed files with 850 additions and 629 deletions
+1
View File
@@ -28,6 +28,7 @@
# #
################################################################################
from __future__ import absolute_import
import sys
import os.path
+5 -3
View File
@@ -26,6 +26,8 @@
# #
################################################################################
from __future__ import absolute_import
from __future__ import print_function
import os
import subprocess
@@ -153,17 +155,17 @@ def findHeadersAndFiles():
elif fullname.endswith(".pyc"):
pass
else:
print "Don't know what to do with", filename
print("Don't know what to do with", filename)
def main():
for header, filename in findHeadersAndFiles():
print "Analyzing", filename
print("Analyzing", filename)
with open(filename) as f:
lines = list(line.rstrip() for line in f)
newLines = header.fix(filename, lines)
if newLines != lines:
print " => actually modifying", filename
print(" => actually modifying", filename)
with open(filename, "w") as f:
for line in newLines:
f.write(line + "\n")