[LNT] r342454 - [LNT] more pep8 code style fixes

Kristof Beyls via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 18 02:17:24 PDT 2018


Author: kbeyls
Date: Tue Sep 18 02:17:23 2018
New Revision: 342454

URL: http://llvm.org/viewvc/llvm-project?rev=342454&view=rev
Log:
[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

Modified:
    lnt/trunk/lnt/server/db/migrations/upgrade_16_to_17.py
    lnt/trunk/lnt/server/db/migrations/util.py
    lnt/trunk/lnt/server/db/regression.py
    lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py
    lnt/trunk/lnt/server/reporting/summaryreport.py
    lnt/trunk/lnt/server/ui/api.py
    lnt/trunk/lnt/testing/__init__.py

Modified: lnt/trunk/lnt/server/db/migrations/upgrade_16_to_17.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/migrations/upgrade_16_to_17.py?rev=342454&r1=342453&r2=342454&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/migrations/upgrade_16_to_17.py (original)
+++ lnt/trunk/lnt/server/db/migrations/upgrade_16_to_17.py Tue Sep 18 02:17:23 2018
@@ -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))
 

Modified: lnt/trunk/lnt/server/db/migrations/util.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/migrations/util.py?rev=342454&r1=342453&r2=342454&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/migrations/util.py (original)
+++ lnt/trunk/lnt/server/db/migrations/util.py Tue Sep 18 02:17:23 2018
@@ -27,7 +27,7 @@ def introspect_table(engine, name, autol
 
 
 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")

Modified: lnt/trunk/lnt/server/db/regression.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/regression.py?rev=342454&r1=342453&r2=342454&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/regression.py (original)
+++ lnt/trunk/lnt/server/db/regression.py Tue Sep 18 02:17:23 2018
@@ -54,8 +54,8 @@ def new_regression(session, ts, field_ch
 
 
 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, regressio
 
 
 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) \

Modified: lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py?rev=342454&r1=342453&r2=342454&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py (original)
+++ lnt/trunk/lnt/server/db/rules/rule_update_fixed_regressions.py Tue Sep 18 02:17:23 2018
@@ -41,9 +41,9 @@ def impacts(session, ts, run_id, regress
     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,
     """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.

Modified: lnt/trunk/lnt/server/reporting/summaryreport.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/summaryreport.py?rev=342454&r1=342453&r2=342454&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/summaryreport.py (original)
+++ lnt/trunk/lnt/server/reporting/summaryreport.py Tue Sep 18 02:17:23 2018
@@ -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:

Modified: lnt/trunk/lnt/server/ui/api.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/api.py?rev=342454&r1=342453&r2=342454&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/api.py (original)
+++ lnt/trunk/lnt/server/ui/api.py Tue Sep 18 02:17:23 2018
@@ -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]

Modified: lnt/trunk/lnt/testing/__init__.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/testing/__init__.py?rev=342454&r1=342453&r2=342454&view=diff
==============================================================================
--- lnt/trunk/lnt/testing/__init__.py (original)
+++ lnt/trunk/lnt/testing/__init__.py Tue Sep 18 02:17:23 2018
@@ -447,11 +447,11 @@ def upgrade_and_normalize_report(data, t
         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




More information about the llvm-commits mailing list