aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Beyls <kristof.beyls@arm.com>2018-09-18 09:17:23 +0000
committerKristof Beyls <kristof.beyls@arm.com>2018-09-18 09:17:23 +0000
commit07b5cd22b6eb5dfdc0c0044371687c43170c468b (patch)
tree260d4bd83950f4443644f7bccb7be1d229fe1b7a
parentf005641a72f25202629832110ecbca9b817362e7 (diff)
[LNT] more pep8 code style fixes
PEP8 code style issues found by pycodestyle, ignoring "line to long:" errors. Patch by Danila Malyutin. Differential Revision: https://reviews.llvm.org/D51862 git-svn-id: https://llvm.org/svn/llvm-project/lnt/trunk@342454 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lnt/server/db/migrations/upgrade_16_to_17.py1
-rw-r--r--lnt/server/db/migrations/util.py2
-rw-r--r--lnt/server/db/regression.py6
-rw-r--r--lnt/server/db/rules/rule_update_fixed_regressions.py8
-rw-r--r--lnt/server/reporting/summaryreport.py2
-rw-r--r--lnt/server/ui/api.py5
-rw-r--r--lnt/testing/__init__.py4
7 files changed, 16 insertions, 12 deletions
diff --git a/lnt/server/db/migrations/upgrade_16_to_17.py b/lnt/server/db/migrations/upgrade_16_to_17.py
index 421ea8e..45fa769 100644
--- a/lnt/server/db/migrations/upgrade_16_to_17.py
+++ b/lnt/server/db/migrations/upgrade_16_to_17.py
@@ -7,6 +7,7 @@ from sqlalchemy import Index, select
from lnt.server.db.migrations.util import introspect_table
from lnt.util import logger
+
def _mk_index_on(engine, ts_name):
fc_table = introspect_table(engine, "{}_RegressionIndicator".format(ts_name))
diff --git a/lnt/server/db/migrations/util.py b/lnt/server/db/migrations/util.py
index 8dad98c..623e4f1 100644
--- a/lnt/server/db/migrations/util.py
+++ b/lnt/server/db/migrations/util.py
@@ -27,7 +27,7 @@ def introspect_table(engine, name, autoload=True):
def rename_table(engine, old_name, new_name):
- """Rename table wiht name \p old_name to \p new_name."""
+ """Rename table with name `old_name` to `new_name`."""
# sqlite refuses to rename "BAR" to "bar" so we go
# "BAR" -> "BAR_x" -> "bar"
rename = _RenameTable(old_name, old_name+"_x")
diff --git a/lnt/server/db/regression.py b/lnt/server/db/regression.py
index 6616ceb..22bd366 100644
--- a/lnt/server/db/regression.py
+++ b/lnt/server/db/regression.py
@@ -54,8 +54,8 @@ def new_regression(session, ts, field_changes):
def rebuild_title(session, ts, regression):
- """Update the title of a regresson."""
- if re.match("Regression of \d+ benchmarks.*", regression.title):
+ """Update the title of a regression."""
+ if re.match(r"Regression of \d+ benchmarks.*", regression.title):
old_changes = session.query(ts.RegressionIndicator) \
.filter(ts.RegressionIndicator.regression_id == regression.id) \
.all()
@@ -73,7 +73,7 @@ def rebuild_title(session, ts, regression):
def get_all_orders_for_machine(session, ts, machine):
- """Get all the oredrs for this sa machine."""
+ """Get all the orders for this sa machine."""
return session.query(ts.Order) \
.join(ts.Run) \
.filter(ts.Run.machine_id == machine) \
diff --git a/lnt/server/db/rules/rule_update_fixed_regressions.py b/lnt/server/db/rules/rule_update_fixed_regressions.py
index a834eba..ddfcdf3 100644
--- a/lnt/server/db/rules/rule_update_fixed_regressions.py
+++ b/lnt/server/db/rules/rule_update_fixed_regressions.py
@@ -41,9 +41,9 @@ def impacts(session, ts, run_id, regression):
machine_id = session.query(ts.Run.machine_id).filter(ts.Run.id == run_id).scalar()
regression_machines = [x[0] for x in session.query(ts.FieldChange.machine_id)
- .join(ts.RegressionIndicator)
- .filter(ts.RegressionIndicator.regression_id == regression.id)
- .all()]
+ .join(ts.RegressionIndicator)
+ .filter(ts.RegressionIndicator.regression_id == regression.id)
+ .all()]
regression_machines_set = set(regression_machines)
return machine_id in regression_machines_set
@@ -54,7 +54,7 @@ def age_out_oldest_regressions(session, ts, num_to_keep=50):
"""Find the oldest regressions that are still in the detected state,
and age them out. This is needed when regressions are not manually
acknowledged, regression analysis can grow unbounded.
-
+
:param session: db session
:param ts: testsuite
:param num_to_keep: the number of newest regressions to keep in the detected state.
diff --git a/lnt/server/reporting/summaryreport.py b/lnt/server/reporting/summaryreport.py
index 3ae8576..f2139a8 100644
--- a/lnt/server/reporting/summaryreport.py
+++ b/lnt/server/reporting/summaryreport.py
@@ -478,7 +478,7 @@ class SummaryReport(object):
continue
# Add to the single file stack.
- stage_name, = re.match('Single File \((.*)\)', test_name).groups()
+ stage_name, = re.match(r'Single File \((.*)\)', test_name).groups()
try:
stack_index = self.single_file_stage_order.index(stage_name)
except ValueError:
diff --git a/lnt/server/ui/api.py b/lnt/server/ui/api.py
index af4dc23..606999e 100644
--- a/lnt/server/ui/api.py
+++ b/lnt/server/ui/api.py
@@ -61,6 +61,7 @@ def add_common_fields(to_update):
"""Update a dict with the common fields."""
to_update.update(common_fields_factory())
+
class Fields(Resource):
"""List all the fields in the test suite."""
method_decorators = [in_db]
@@ -71,10 +72,11 @@ class Fields(Resource):
result = common_fields_factory()
result['fields'] = [{'column_id': i, 'column_name': f.column.name}
- for i, f in enumerate(ts.sample_fields)]
+ for i, f in enumerate(ts.sample_fields)]
return result
+
class Tests(Resource):
"""List all the tests in the test suite."""
method_decorators = [in_db]
@@ -89,6 +91,7 @@ class Tests(Resource):
return result
+
class Machines(Resource):
"""List all the machines and give summary information."""
method_decorators = [in_db]
diff --git a/lnt/testing/__init__.py b/lnt/testing/__init__.py
index 285d904..6fbc792 100644
--- a/lnt/testing/__init__.py
+++ b/lnt/testing/__init__.py
@@ -447,11 +447,11 @@ def upgrade_and_normalize_report(data, ts_name):
raise ValueError("No 'tests' section in submission")
run = data['run']
- if not 'start_time' in run:
+ if 'start_time' not in run:
time = datetime.datetime.utcnow().replace(microsecond=0).isoformat()
run['start_time'] = time
run['end_time'] = time
- elif not 'end_time' in run:
+ elif 'end_time' not in run:
run['end_time'] = run['start_time']
return data