jenkins-bot has submitted this change and it was merged.
Change subject: Modify relcomp.py to pass flake8
......................................................................
Modify relcomp.py to pass flake8
flake8 wasn't enabled for a while, so some older code doesn't pass.
Fix that.
Change-Id: I4b2db2b57363a35aab65f46d6d6d34132de25a58
---
M relcomp.py
1 file changed, 10 insertions(+), 9 deletions(-)
Approvals:
DCausse: Looks good to me, approved
jenkins-bot: Verified
diff --git a/relcomp.py b/relcomp.py
index 7370322..b0ae581 100755
--- a/relcomp.py
+++ b/relcomp.py
@@ -40,6 +40,7 @@
image_dir = "images/"
image_path = ""
+
class Metric(object):
"""A metric of some sort that we want to keep track of while comparing two
query runs.
@@ -231,7 +232,7 @@
ret_string = super(TopNDiff, self).results(what)
if what == "delta" and not self.sorted and self.showstats:
ret_string += num_num0_pct_chart(self.magnitude,
"top{}".format(self.topN),
- "Top {} Results".format(self.topN))
+ "Top {}
Results".format(self.topN))
return ret_string
def has_condition(self, x, y, is_baseline=False):
@@ -262,7 +263,7 @@
y_ids = set(y_ids)
if self.showstats:
intersection = x_ids.intersection(y_ids)
- edit_dist = max(len(x_ids) , len(y_ids)) - len(intersection)
+ edit_dist = max(len(x_ids), len(y_ids)) - len(intersection)
self.magnitude.append([len(x_ids), edit_dist])
if len(x_ids) != len(y_ids):
return 1
@@ -438,20 +439,20 @@
def num_num0_pct_chart(data, file_prefix, label):
ret_string = ""
num_changed = [x[1] for x in data]
- pct_changed = [x[1]/x[0] if x[0]!=0 else x[1] for x in data]
+ pct_changed = [x[1]/x[0] if x[0] != 0 else x[1] for x in data]
indent = " "
file_num0 = "{}_num0.png".format(file_prefix)
file_num = "{}_num.png".format(file_prefix)
file_pct = "{}_pct.png".format(file_prefix)
make_hist(num_changed, image_path + file_num0,
- xlab="Number {} Changed".format(label), ylab="Frequency",
- title="All queries, by number of changed {}".format(label))
+ xlab="Number {} Changed".format(label), ylab="Frequency",
+ title="All queries, by number of changed {}".format(label))
make_hist([x for x in num_changed if x != 0], image_path + file_num,
- xlab="Number {} Changed".format(label), ylab="Frequency",
- title="Changed queries, by number of changed {}".format(label))
+ xlab="Number {} Changed".format(label), ylab="Frequency",
+ title="Changed queries, by number of changed {}".format(label))
make_hist([x for x in pct_changed if x != 0], image_path + file_pct,
- xlab="Percent {} Changed".format(label), ylab="Frequency",
xformat="pct",
- title="Changed queries, by percent of changed {}".format(label))
+ xlab="Percent {} Changed".format(label), ylab="Frequency",
xformat="pct",
+ title="Changed queries, by percent of changed {}".format(label))
ret_string += indent + "Num {} Changed: μ: ".format(label) +\
"{:0.2f}; σ: {:0.2f}; median: {:0.2f}<br>\n".format(
numpy.mean(num_changed), numpy.std(num_changed),
numpy.median(num_changed))
--
To view, visit https://gerrit.wikimedia.org/r/280692
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4b2db2b57363a35aab65f46d6d6d34132de25a58
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/discovery/relevanceForge
Gerrit-Branch: master
Gerrit-Owner: Tjones <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits