Skip to content

Commit

Permalink
Py3: from __future__ import print_function, xrange()
Browse files Browse the repository at this point in the history
from __future__ import print_function for Python 3
* Also, define xrange() for Python 3 because it was removed in favor of range()
  • Loading branch information
cclauss authored Oct 30, 2017
1 parent 0533366 commit 3a02da7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions generate_aliases.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function
import itertools
import sys
import os.path
import sys

try:
xrange # Python 2
except NameError:
xrange = range # Python 3


def main():
# (alias, full, restrict_to_aliases, incompatible_with)
Expand Down Expand Up @@ -83,12 +90,12 @@ def main():
# prepare output
if not sys.stdout.isatty():
header_path=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'license_header')
with open(header_path, 'r') as f: print f.read()
with open(header_path, 'r') as f: print(f.read())
for cmd in out:
print "alias {}='{}'".format(
print("alias {}='{}'".format(
''.join([a[0] for a in cmd]),
' '.join([a[1] for a in cmd])
)
))

def gen(parts):
out = [()]
Expand Down

0 comments on commit 3a02da7

Please sign in to comment.