From 991cb0ed962f348761ad473aa5ce5c0da12333ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davi=20Ant=C3=B4nio?= <30875784+DaviAntonio@users.noreply.github.com> Date: Thu, 30 Mar 2023 11:48:17 +0000 Subject: Release 1.5.18-1 (#28) * Update version info and year The following files were updated to the next version to be released and the current year: - src/version - src/versionnum.php * Release 1.5.17-1 Update changelog with all the changes made since its last update on commit 818abd88. * Format code with black 23.1.0 * Release 1.5.18-1 Update changelog with all the changes made since its last update on commit 194f6764. --- debian/changelog | 12 ++++++++++ src/admin/report/barplot.py | 16 ++++++------- src/admin/report/piechart.py | 57 ++++++++++++++++++++++++++++---------------- 3 files changed, 56 insertions(+), 29 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6dfb332..c78529b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +boca (1.5.18-1) jammy; urgency=medium + + [ Bruno Ribas ] + * private/score.sep: more sane default + * barplot.py: moved to the correct location + * d/control: add python3-matplotlib as depends for boca-web + + [ Davi Antônio da Silva Santos ] + * Format code with black 23.1.0 + + -- Davi Antônio da Silva Santos Wed, 29 Mar 2023 17:09:19 -0300 + boca (1.5.17-1) jammy; urgency=medium [ Bruno Ribas ] diff --git a/src/admin/report/barplot.py b/src/admin/report/barplot.py index d07f156..edc9df1 100644 --- a/src/admin/report/barplot.py +++ b/src/admin/report/barplot.py @@ -5,23 +5,23 @@ filename = sys.argv[1] title = sys.argv[2] -x = [str(x) + '-' + str(x+10) for x in range(0,300,10)] +x = [str(x) + "-" + str(x + 10) for x in range(0, 300, 10)] -with open(filename,'r') as file: +with open(filename, "r") as file: y = [int(line) for line in file] # Create a bar plot -plt.bar(x, y,width=0.5) +plt.bar(x, y, width=0.5) # Set the y-axis tick labels to step by 5 plt.xticks(rotation=90) -if(max(y)<200): - plt.yticks(range(0, max(y)+1, 5)) +if max(y) < 200: + plt.yticks(range(0, max(y) + 1, 5)) else: - plt.yticks(range(0, max(y)+1, 10)) + plt.yticks(range(0, max(y) + 1, 10)) # Add gridlines to the y-axis -plt.grid(axis='y') +plt.grid(axis="y") # Add a title to the plot plt.title(title) @@ -29,4 +29,4 @@ plt.title(title) plt.tight_layout() # Show the plot -plt.savefig(filename.replace('.txt','.png'),dpi=600,transparent=True) +plt.savefig(filename.replace(".txt", ".png"), dpi=600, transparent=True) diff --git a/src/admin/report/piechart.py b/src/admin/report/piechart.py index 75e5a9d..70904bb 100644 --- a/src/admin/report/piechart.py +++ b/src/admin/report/piechart.py @@ -4,37 +4,52 @@ import sys filename = sys.argv[1] title = sys.argv[2] -label=[] -value=[] +label = [] +value = [] color = [] -with open(filename,'r') as f: +with open(filename, "r") as f: for line in f: tokens = line.split() c = tokens[-1] - problem_data = ' '.join(tokens[0:-1]) - l,v = problem_data.split(':') - if(int(v)>0): - label.append(l+'('+v+')') + problem_data = " ".join(tokens[0:-1]) + l, v = problem_data.split(":") + if int(v) > 0: + label.append(l + "(" + v + ")") value.append(v) color.append(c) -wedges, texts, autotexts = plt.pie(value, colors=color,autopct=lambda p: '{:.1f}%'.format(round(p)) if p > 0 else '',pctdistance=1.2,wedgeprops= {"edgecolor":"black", - 'linewidth': 1, - 'antialiased': False}) +wedges, texts, autotexts = plt.pie( + value, + colors=color, + autopct=lambda p: "{:.1f}%".format(round(p)) if p > 0 else "", + pctdistance=1.2, + wedgeprops={"edgecolor": "black", "linewidth": 1, "antialiased": False}, +) -plt.legend(wedges, label, - loc="center left", - bbox_to_anchor=(1.1, 0, 0.5,1)) +plt.legend(wedges, label, loc="center left", bbox_to_anchor=(1.1, 0, 0.5, 1)) # Add title -plt.title(title,pad=20) -if(len(sys.argv)<=3): - plt.legend(label, bbox_to_anchor=(1.1,0.5), loc="center right", fontsize=10, - bbox_transform=plt.gcf().transFigure,shadow=True) +plt.title(title, pad=20) +if len(sys.argv) <= 3: + plt.legend( + label, + bbox_to_anchor=(1.1, 0.5), + loc="center right", + fontsize=10, + bbox_transform=plt.gcf().transFigure, + shadow=True, + ) else: - plt.legend(label,loc="lower center", bbox_to_anchor=(0.5,-0.1), fontsize=10, - bbox_transform=plt.gcf().transFigure,shadow=True) + plt.legend( + label, + loc="lower center", + bbox_to_anchor=(0.5, -0.1), + fontsize=10, + bbox_transform=plt.gcf().transFigure, + shadow=True, + ) # Show plot # plt.tight_layout() -plt.savefig(filename.replace('.txt','.png'),dpi=600,transparent=True, bbox_inches="tight") - +plt.savefig( + filename.replace(".txt", ".png"), dpi=600, transparent=True, bbox_inches="tight" +) -- cgit v1.2.3