From ea91211f273ee87da9094b945a758439d91f3ff6 Mon Sep 17 00:00:00 2001 From: Jason Lowe-Power Date: Wed, 13 May 2020 17:32:58 -0700 Subject: [PATCH] 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 --- util/style/file_types.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.30.2