[PATCH] D67582: [LNT] Python 3 support: Remove implicit tuple parameter unpacking on lambdas
Hubert Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 20:56:28 PDT 2019
hubert.reinterpretcast created this revision.
hubert.reinterpretcast added reviewers: cmatthews, thopre, kristof.beyls.
Lambda changes split out and updated from D67535 <https://reviews.llvm.org/D67535>.
Applies the `2to3 -f tuple_params` fixes, tweaks the variable naming, and updates the affected tuples to be named tuples.
https://reviews.llvm.org/D67582
Files:
lnt/server/reporting/runs.py
lnt/server/ui/views.py
Index: lnt/server/ui/views.py
===================================================================
--- lnt/server/ui/views.py
+++ lnt/server/ui/views.py
@@ -799,6 +799,8 @@
show_highlight = not options['hide_highlight']
# Load the graph parameters.
+ GraphParameter = namedtuple('GraphParameter',
+ ['machine', 'test', 'field', 'field_index'])
graph_parameters = []
for name, value in request.args.items():
# Plots to graph are passed as::
@@ -827,10 +829,12 @@
field = ts.sample_fields[field_index]
except NoResultFound:
return abort(404)
- graph_parameters.append((machine, test, field, field_index))
+ graph_parameters.append(GraphParameter(machine, test, field, field_index))
# Order the plots by machine name, test name and then field.
- graph_parameters.sort(key=lambda (m, t, f, _): (m.name, t.name, f.name, _))
+ graph_parameters.sort(key=lambda graph_parameter:
+ (graph_parameter.machine.name, graph_parameter.test.name,
+ graph_parameter.field.name, graph_parameter.field_index))
# Extract requested mean trend.
mean_parameter = None
Index: lnt/server/reporting/runs.py
===================================================================
--- lnt/server/reporting/runs.py
+++ lnt/server/reporting/runs.py
@@ -2,6 +2,7 @@
Report functionality centered around individual runs.
"""
+from collections import namedtuple
import time
import lnt.server.reporting.analysis
import lnt.server.ui.app
@@ -123,7 +124,9 @@
if not bucket or bucket_name == 'Unchanged Test' or not show_perf:
return bucket
else:
- return sorted(bucket, key=lambda (_, cr, __): -abs(cr.pct_delta))
+ return sorted(
+ bucket,
+ key=lambda bucket_entry: -abs(bucket_entry.cr.pct_delta))
def prioritize_buckets(test_results):
prioritized = [(priority, field, bucket_name,
@@ -212,6 +215,7 @@
return data
+BucketEntry = namedtuple('BucketEntry', ['name', 'cr', 'test_id'])
def _get_changes_by_type(ts, run_a, run_b, metric_fields, test_names,
num_comparison_runs, sri):
comparison_results = {}
@@ -249,7 +253,7 @@
else:
bucket = unchanged_tests
- bucket.append((name, cr, test_id))
+ bucket.append(BucketEntry(name, cr, test_id))
results_by_type.append(
(field, (('New Failures', new_failures, False),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67582.220204.patch
Type: text/x-patch
Size: 2588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190914/57fa4871/attachment.bin>
More information about the llvm-commits
mailing list