misc,python: Run pre-commit run --all-files

Applies the `pyupgrade` hook to all files in the repo.

Change-Id: I9879c634a65c5fcaa9567c63bc5977ff97d5d3bf
This commit is contained in:
Bobby R. Bruce
2023-10-09 13:40:03 -07:00
parent 83af4525ce
commit 298119e402
188 changed files with 741 additions and 779 deletions

View File

@@ -127,7 +127,7 @@ def plotLowPStates(
@param delay_list: list of itt max multipliers (e.g. [1, 20, 200])
"""
stats_file = open(stats_fname, "r")
stats_file = open(stats_fname)
global bankUtilValues
bankUtilValues = bank_util_list

View File

@@ -56,14 +56,14 @@ def main():
exit(-1)
try:
stats = open(sys.argv[1] + "/stats.txt", "r")
except IOError:
stats = open(sys.argv[1] + "/stats.txt")
except OSError:
print("Failed to open ", sys.argv[1] + "/stats.txt", " for reading")
exit(-1)
try:
simout = open(sys.argv[1] + "/simout.txt", "r")
except IOError:
simout = open(sys.argv[1] + "/simout.txt")
except OSError:
print("Failed to open ", sys.argv[1] + "/simout.txt", " for reading")
exit(-1)
@@ -77,7 +77,7 @@ def main():
if got_ranges:
ranges.append(int(line) / 1024)
match = re.match("lat_mem_rd with (\d+) iterations, ranges:.*", line)
match = re.match(r"lat_mem_rd with (\d+) iterations, ranges:.*", line)
if match:
got_ranges = True
iterations = int(match.groups(0)[0])
@@ -92,7 +92,7 @@ def main():
raw_rd_lat = []
for line in stats:
match = re.match(".*readLatencyHist::mean\s+(.+)\s+#.*", line)
match = re.match(r".*readLatencyHist::mean\s+(.+)\s+#.*", line)
if match:
raw_rd_lat.append(float(match.groups(0)[0]) / 1000)
stats.close()

View File

@@ -73,14 +73,14 @@ def main():
mode = sys.argv[1][1]
try:
stats = open(sys.argv[2] + "/stats.txt", "r")
except IOError:
stats = open(sys.argv[2] + "/stats.txt")
except OSError:
print("Failed to open ", sys.argv[2] + "/stats.txt", " for reading")
exit(-1)
try:
simout = open(sys.argv[2] + "/simout.txt", "r")
except IOError:
simout = open(sys.argv[2] + "/simout.txt")
except OSError:
print("Failed to open ", sys.argv[2] + "/simout.txt", " for reading")
exit(-1)
@@ -90,7 +90,7 @@ def main():
for line in simout:
match = re.match(
"DRAM sweep with burst: (\d+), banks: (\d+), max stride: (\d+)",
r"DRAM sweep with burst: (\d+), banks: (\d+), max stride: (\d+)",
line,
)
if match:
@@ -113,15 +113,15 @@ def main():
avg_pwr = []
for line in stats:
match = re.match(".*busUtil\s+(\d+\.\d+)\s+#.*", line)
match = re.match(r".*busUtil\s+(\d+\.\d+)\s+#.*", line)
if match:
bus_util.append(float(match.groups(0)[0]))
match = re.match(".*peakBW\s+(\d+\.\d+)\s+#.*", line)
match = re.match(r".*peakBW\s+(\d+\.\d+)\s+#.*", line)
if match:
peak_bw.append(float(match.groups(0)[0]))
match = re.match(".*averagePower\s+(\d+\.?\d*)\s+#.*", line)
match = re.match(r".*averagePower\s+(\d+\.?\d*)\s+#.*", line)
if match:
avg_pwr.append(float(match.groups(0)[0]))
stats.close()

View File

@@ -106,7 +106,7 @@ def main():
filename = plotter.stateTimePlotName(str(delay) + "-")
outfile.write(wrapForGraphic(filename, textwidth))
outfile.write(getCaption(delay))
outfile.write("\end{figure}\n")
outfile.write("\\end{figure}\n")
# Energy plots for all delay values
outfile.write("\\begin{figure} \n\\centering\n")