misc: Use python f-strings for string formatting

This patch has been generated by applying flynt to the
gem5 repo (ext has been excluded)

JIRA: https://gem5.atlassian.net/browse/GEM5-831

Change-Id: I0935db6223d5426b99515959bde78e374cbadb04
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68957
Maintainer: Bobby Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Giacomo Travaglini
2023-03-15 13:34:46 +00:00
parent 07fca546e6
commit e73655d038
242 changed files with 814 additions and 1002 deletions

View File

@@ -51,7 +51,7 @@ from shutil import rmtree, copyfile
def hex_mask(terms):
dec_mask = reduce(operator.or_, [2**i for i in terms], 0)
return "%08x" % dec_mask
return f"{dec_mask:08x}"
def file_append(path, contents):
@@ -252,13 +252,13 @@ def _redirect_paths(options):
# Redirect filesystem syscalls from src to the first matching dests
redirect_paths = [
RedirectPath(
app_path="/proc", host_paths=["%s/fs/proc" % m5.options.outdir]
app_path="/proc", host_paths=[f"{m5.options.outdir}/fs/proc"]
),
RedirectPath(
app_path="/sys", host_paths=["%s/fs/sys" % m5.options.outdir]
app_path="/sys", host_paths=[f"{m5.options.outdir}/fs/sys"]
),
RedirectPath(
app_path="/tmp", host_paths=["%s/fs/tmp" % m5.options.outdir]
app_path="/tmp", host_paths=[f"{m5.options.outdir}/fs/tmp"]
),
]
@@ -275,7 +275,7 @@ def _redirect_paths(options):
if chroot:
redirect_paths.append(
RedirectPath(
app_path="/", host_paths=["%s" % os.path.expanduser(chroot)]
app_path="/", host_paths=[f"{os.path.expanduser(chroot)}"]
)
)