Auto-format Python scripts

This commit is contained in:
sharkdp committed 2020-04-01 09:35:09 +02:00
1 parent a870d4db3d
commit 8fff8643e0
5 files changed
+23 -17

No files matched your search

+4 -2
View File
@@ -31,6 +31,8 @@ for command, ts in zip(commands, times):
print()
print(" percentiles:")
print(" P_05 .. P_95: {:.3f} s .. {:.3f} s".format(p05, p95))
print(" P_25 .. P_75: {:.3f} s .. {:.3f} s "
"(IQR = {:.3f} s)".format(p25, p75, iqr))
print(
" P_25 .. P_75: {:.3f} s .. {:.3f} s "
"(IQR = {:.3f} s)".format(p25, p75, iqr)
)
print()
+8 -6
View File
@@ -18,12 +18,14 @@ with open(args.file) as f:
commands = [b["command"] for b in results]
all_times = [b["times"] for b in results]
plt.hist(all_times,
label=commands,
bins="auto",
histtype="bar",
range=(np.min(all_times), np.max(all_times)))
plt.legend(prop={'family': ['Source Code Pro', 'Fira Mono', 'Courier New']})
plt.hist(
all_times,
label=commands,
bins="auto",
histtype="bar",
range=(np.min(all_times), np.max(all_times)),
)
plt.legend(prop={"family": ["Source Code Pro", "Fira Mono", "Courier New"]})
plt.xlabel("Time [s]")
if args.title:
+7 -6
View File
@@ -9,8 +9,12 @@ import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("file", help="JSON file with benchmark results", nargs="+")
parser.add_argument("--parameter-name", metavar="name", type=str,
help="Name of the parameter / x-axis label")
parser.add_argument(
"--parameter-name",
metavar="name",
type=str,
help="Name of the parameter / x-axis label",
)
args = parser.parse_args()
for filename in args.file:
@@ -21,10 +25,7 @@ for filename in args.file:
times_mean = [b["mean"] for b in results]
times_stddev = [b["stddev"] for b in results]
plt.errorbar(x=parameter_values,
y=times_mean,
yerr=times_stddev,
capsize=2)
plt.errorbar(x=parameter_values, y=times_mean, yerr=times_stddev, capsize=2)
plt.xlabel(args.parameter_name)
plt.ylabel("Time [s]")
+3 -1
View File
@@ -15,7 +15,9 @@ import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("file", help="JSON file with benchmark results")
parser.add_argument("--title", help="Plot Title")
parser.add_argument("--labels", help="Comma-separated list of entries for the plot legend")
parser.add_argument(
"--labels", help="Comma-separated list of entries for the plot legend"
)
args = parser.parse_args()
with open(args.file) as f:
+1 -2
View File
@@ -33,7 +33,6 @@ print("t = {:.3}, p = {:.3}".format(t, p))
print()
if dispose:
print("There is a difference between the "
"two benchmarks (p < {}).".format(th))
print("There is a difference between the two benchmarks (p < {}).".format(th))
else:
print("The two benchmarks are almost the same (p >= {}).".format(th))