Skip to content

Commit 161ab16

Browse files
author
Thomas Preud'homme
committed
F841: local variable assigned to but never used
tests/server/reporting/analysis.py: - Ignore unused variables spike and slow which commented code further down refers to lnt/server/ui/api.py: - Local variable machine_name and ts in function put() were seemingly introduced from copy/paste and were never used lnt/server/ui/views.py: - Local variable comparison_start_run stopped being used from commit 465d5fd - Local variable session in function v4_latest_runs_report() was seemingly introduced from copy/paste and was never used lnt/server/ui/profile_views.py: - Local variables idx and tlc in function v4_profile_ajax_getFunctions() were seemingly introduced from copy/paste and were never used - Local variable profileDir in function v4_profile() was seemingly introduced from copy/paste and was never used - Local variables profile1 and profile2 in function v4_profile() have never been used lnt/server/ui/regression_views.py: - Local variable e in exception block of function v4_regression_detail() has never been used - Local variable new_regression_id in function v4_make_regression() has never been used lnt/server/reporting/summaryreport.py: - Local variables run and datapoints in function _build_data_table() have never been used lnt/server/db/testsuitedb.py: - Local variable testsuitedb in the constructor has never been used lnt/server/db/fieldchange.py: - Local variable deleted in function regenerate_fieldchanges_for_run() has never been used lnt/server/db/migrations/upgrade_14_to_15.py: - Local variable trans in function update_testsuite() was seemingly introduced from copy/paste from other migration scripts and was never used tests/testing/profilev1impl.py: - Local variable s in function test_serialize() has never been used tests/testing/profilev2impl.py: - Local variable s in function test_serialize() was seemingly introduced from copy/past eof the v1 version and was never used Reviewed By: tnfchris Differential Revision: https://reviews.llvm.org/D94757
1 parent 2e93cbd commit 161ab16

File tree

11 files changed

+9
-32
lines changed

11 files changed

+9
-32
lines changed

lnt/server/db/fieldchange.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def regenerate_fieldchanges_for_run(session, ts, run_id):
159159
if not result.is_result_performance_change() and f:
160160
# With more data, its not a regression. Kill it!
161161
logger.info("Removing field change: {}".format(f.id))
162-
deleted = delete_fieldchange(session, ts, f)
162+
delete_fieldchange(session, ts, f)
163163
continue
164164

165165
if result.is_result_performance_change() and not f:

lnt/server/db/migrations/upgrade_14_to_15.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def update_testsuite(engine, db_key_name):
88
table_name = '%s_FieldChange' % db_key_name
9-
with engine.begin() as trans:
9+
with engine.begin():
1010
table = introspect_table(engine, table_name, autoload=False)
1111
table.drop(checkfirst=True)
1212

lnt/server/db/testsuitedb.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class TestSuiteDB(object):
4949
"""
5050

5151
def __init__(self, v4db, name, test_suite):
52-
testsuitedb = self
5352
self.v4db = v4db
5453
self.name = name
5554
self.test_suite = test_suite

lnt/server/reporting/summaryreport.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,6 @@ def get_datapoints_for_sample(ts, sample):
344344
samples = session.query(*columns).filter(
345345
ts.Sample.run_id.in_(list(run_id_map.keys())))
346346
for sample in samples:
347-
run = run_id_map[sample[0]]
348-
datapoints = list()
349347
for key, value in get_datapoints_for_sample(ts, sample):
350348
items = self.data_table.get(key)
351349
if items is None:

lnt/server/ui/api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,10 @@ def perform_delete(ts, machine):
195195
@requires_auth_token
196196
def put(machine_spec):
197197
machine = Machine._get_machine(machine_spec)
198-
machine_name = "%s:%s" % (machine.name, machine.id)
199198
data = json.loads(request.data)
200199
machine_data = data['machine']
201200
machine.set_from_dict(machine_data)
202201
session = request.session
203-
ts = request.get_testsuite()
204202
session.commit()
205203

206204
@staticmethod

lnt/server/ui/profile_views.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ def v4_profile_ajax_getFunctions():
6767

6868
profileDir = current_app.old_config.profileDir
6969

70-
idx = 0
71-
tlc = {}
7270
sample = _get_sample(session, ts, runid, testid)
7371

7472
if sample and sample.profile:
@@ -135,7 +133,6 @@ def v4_profile_fwd2(testid, run1_id, run2_id=None):
135133
def v4_profile(testid, run1_id, run2_id=None):
136134
session = request.session
137135
ts = request.get_testsuite()
138-
profileDir = current_app.old_config.profileDir
139136

140137
try:
141138
test = session.query(ts.Test).filter(ts.Test.id == testid).one()
@@ -151,16 +148,6 @@ def v4_profile(testid, run1_id, run2_id=None):
151148
# FIXME: Make this a nicer error page.
152149
abort(404)
153150

154-
if sample1.profile:
155-
profile1 = sample1.profile
156-
else:
157-
profile1 = None
158-
159-
if sample2 and sample2.profile:
160-
profile2 = sample2.profile
161-
else:
162-
profile2 = None
163-
164151
json_run1 = {
165152
'id': run1.id,
166153
'order': run1.order.llvm_project_revision,

lnt/server/ui/regression_views.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def v4_regression_detail(id):
289289
regression_info = session.query(ts.Regression) \
290290
.filter(ts.Regression.id == id) \
291291
.one()
292-
except NoResultFound as e:
292+
except NoResultFound:
293293
abort(404)
294294
if request.method == 'POST' and request.form['save_btn'] == "Save Changes":
295295
regression_info.title = form.title.data
@@ -411,7 +411,6 @@ def v4_make_regression(machine_id, test_id, field_index, run_id):
411411
session = request.session
412412
ts = request.get_testsuite()
413413
field = ts.sample_fields[field_index]
414-
new_regression_id = 0
415414
run = session.query(ts.Run).get(run_id)
416415

417416
runs = session.query(ts.Run). \

lnt/server/ui/views.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,6 @@ def __init__(self, run_id):
407407
else:
408408
baseline = None
409409

410-
# Gather the runs to use for statistical data.
411-
comparison_start_run = compare_to or self.run
412-
413410
# We're going to render this on a real webpage with CSS support, so
414411
# override the default styles and provide bootstrap class names for
415412
# the tables.
@@ -1520,7 +1517,6 @@ def to_key(name):
15201517

15211518
@v4_route("/latest_runs_report")
15221519
def v4_latest_runs_report():
1523-
session = request.session
15241520
ts = request.get_testsuite()
15251521

15261522
num_runs_str = request.args.get('num_runs')

tests/server/reporting/analysis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,13 @@ def test_noise_bimodal_overlapping_regression(self):
277277
self.assertEqual(bimodal.get_value_status(), REGRESSED)
278278

279279
def test_single_spike(self):
280-
spike = ComparisonResult(
280+
spike = ComparisonResult( # noqa: F841 # relates to commented code
281281
min, False, False, [SPIKE[11]], SPIKE[0:10], None, None)
282282
# Fixme
283283
# self.assertEqual(spike.get_value_status(), UNCHANGED_PASS)
284284

285285
def test_noise_single_spike(self):
286-
spike = ComparisonResult(
286+
spike = ComparisonResult( # noqa: F841 # relates to commented code
287287
min, False, False, [NOISE_SPIKE[8]], NOISE_SPIKE[0:7], None, None)
288288
# Fixme
289289
# self.assertEqual(spike.get_value_status(), UNCHANGED_PASS)
@@ -300,13 +300,13 @@ def test_noise_slow_regression(self):
300300
self.assertEqual(slow.get_value_status(), REGRESSED)
301301

302302
def test_slow_improvement(self):
303-
slow = ComparisonResult(
303+
slow = ComparisonResult( # noqa: F841 # relates to commented code
304304
min, False, False, [SLOW_IMP[12]], SLOW_IMP[0:11], None, None)
305305
# Fixme
306306
# self.assertEqual(slow.get_value_status(), IMPROVED)
307307

308308
def test_noise_slow_improvement(self):
309-
slow = ComparisonResult(
309+
slow = ComparisonResult( # noqa: F841 # relates to commented code
310310
min, False, False, [SLOW_IMP_NOISE[12]], SLOW_IMP_NOISE[0:11],
311311
None, None)
312312
# Fixme

tests/testing/profilev1impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def setUp(self):
3131
def test_serialize(self):
3232
p = ProfileV1(copy.deepcopy(self.test_data))
3333
with tempfile.NamedTemporaryFile() as f:
34-
s = p.serialize(f.name)
34+
p.serialize(f.name)
3535
self.assertTrue(ProfileV1.checkFile(f.name))
3636

3737
def test_deserialize(self):

0 commit comments

Comments
 (0)