From: Jason Lowe-Power Date: Thu, 14 May 2020 00:32:58 +0000 (-0700) Subject: util: Update style file->open for python3 X-Git-Tag: v20.0.0.0~35 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ea91211f273ee87da9094b945a758439d91f3ff6;p=gem5.git util: Update style file->open for python3 Change-Id: Ibcce194b1905f0e7f29aa91fd0ff881ba879ad51 Signed-off-by: Jason Lowe-Power Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/29068 Maintainer: Bobby R. Bruce Tested-by: kokoro Reviewed-by: Giacomo Travaglini --- diff --git a/util/style/file_types.py b/util/style/file_types.py index 2577492fd..40d0c6f28 100644 --- a/util/style/file_types.py +++ b/util/style/file_types.py @@ -104,7 +104,7 @@ def lang_type(filename, firstline=None, openok=True): # if a first line was not provided but the file is ok to open, # grab the first line of the file. if firstline is None and openok: - handle = file(filename, 'r') + handle = open(filename, 'r') firstline = handle.readline() handle.close() @@ -173,7 +173,7 @@ def update_file(dst, src, language, mutator): mode = 'r+' else: mode = 'r' - src = file(src, mode) + src = open(src, mode) orig_lines = [] @@ -196,7 +196,7 @@ def update_file(dst, src, language, mutator): elif isinstance(dst, str): # if we're not updating in place and a destination file name # was provided, create a file object - dst = file(dst, 'w') + dst = open(dst, 'w') for line in new_lines: dst.write(line)