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:
@@ -358,36 +358,35 @@ def switchCpus(system, cpuList, verbose=True):
|
||||
memory_mode_name = new_cpus[0].memory_mode()
|
||||
for old_cpu, new_cpu in cpuList:
|
||||
if not isinstance(old_cpu, objects.BaseCPU):
|
||||
raise TypeError("%s is not of type BaseCPU" % old_cpu)
|
||||
raise TypeError(f"{old_cpu} is not of type BaseCPU")
|
||||
if not isinstance(new_cpu, objects.BaseCPU):
|
||||
raise TypeError("%s is not of type BaseCPU" % new_cpu)
|
||||
raise TypeError(f"{new_cpu} is not of type BaseCPU")
|
||||
if new_cpu in old_cpu_set:
|
||||
raise RuntimeError(
|
||||
"New CPU (%s) is in the list of old CPUs." % (old_cpu,)
|
||||
f"New CPU ({old_cpu}) is in the list of old CPUs."
|
||||
)
|
||||
if not new_cpu.switchedOut():
|
||||
raise RuntimeError("New CPU (%s) is already active." % (new_cpu,))
|
||||
raise RuntimeError(f"New CPU ({new_cpu}) is already active.")
|
||||
if not new_cpu.support_take_over():
|
||||
raise RuntimeError(
|
||||
"New CPU (%s) does not support CPU handover." % (old_cpu,)
|
||||
f"New CPU ({old_cpu}) does not support CPU handover."
|
||||
)
|
||||
if new_cpu.memory_mode() != memory_mode_name:
|
||||
raise RuntimeError(
|
||||
"%s and %s require different memory modes."
|
||||
% (new_cpu, new_cpus[0])
|
||||
f"{new_cpu} and {new_cpus[0]} require different memory modes."
|
||||
)
|
||||
if old_cpu.switchedOut():
|
||||
raise RuntimeError("Old CPU (%s) is inactive." % (new_cpu,))
|
||||
raise RuntimeError(f"Old CPU ({new_cpu}) is inactive.")
|
||||
if not old_cpu.support_take_over():
|
||||
raise RuntimeError(
|
||||
"Old CPU (%s) does not support CPU handover." % (old_cpu,)
|
||||
f"Old CPU ({old_cpu}) does not support CPU handover."
|
||||
)
|
||||
|
||||
MemoryMode = params.allEnums["MemoryMode"]
|
||||
try:
|
||||
memory_mode = MemoryMode(memory_mode_name).getValue()
|
||||
except KeyError:
|
||||
raise RuntimeError("Invalid memory mode (%s)" % memory_mode_name)
|
||||
raise RuntimeError(f"Invalid memory mode ({memory_mode_name})")
|
||||
|
||||
drain()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user