Skip to content

Commit b98b238

Browse files
committed
fix + ruff format
1 parent 33f2d4b commit b98b238

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

ctf/stats.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,20 +221,31 @@ def stats(
221221
for value, count in stats["flag_count_per_value"].items():
222222
number_of_points.append(value * count)
223223

224-
ax1.bar(list(stats["flag_count_per_value"].keys()), list(stats["flag_count_per_value"].values()), -width,
225-
label="Number of points", color="blue", align="edge")
224+
ax1.bar(
225+
list(stats["flag_count_per_value"].keys()),
226+
list(stats["flag_count_per_value"].values()),
227+
-width,
228+
label="Number of flags",
229+
color="blue",
230+
align="edge",
231+
)
226232
ax1.set_xlabel("Flag Value (points)")
227233
ax1.set_ylabel("Number of Flags", color="blue")
228-
ax1.tick_params(axis='y', labelcolor="blue")
234+
ax1.tick_params(axis="y", labelcolor="blue")
229235

230236
ax2 = ax1.twinx()
231237

232-
ax2.bar(list(stats["flag_count_per_value"].keys()), number_of_points, width, label="Number of flags",
233-
color="orange",
234-
align="edge")
238+
ax2.bar(
239+
list(stats["flag_count_per_value"].keys()),
240+
number_of_points,
241+
width,
242+
label="Number of points",
243+
color="orange",
244+
align="edge",
245+
)
235246
ax2.set_xlabel("Flag Value")
236247
ax2.set_ylabel("Number of points", color="orange")
237-
ax2.tick_params(axis='y', labelcolor="orange")
248+
ax2.tick_params(axis="y", labelcolor="orange")
238249

239250
plt.xticks(
240251
ticks=range(0, max(stats["flag_count_per_value"].keys()) + 1), rotation=45
@@ -243,7 +254,7 @@ def stats(
243254
plt.grid(True, linestyle="--", alpha=0.3)
244255
plt.xlabel("Flag Value")
245256
plt.title("Number of Flags per Value")
246-
fig.legend(loc='upper right')
257+
fig.legend(loc="upper right")
247258

248259
plt.savefig(os.path.join(".charts", "flags_per_value.png"))
249260
plt.clf()

0 commit comments

Comments
 (0)