superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: [flake8] Resolving F8?? errors (#3778)
Date Tue, 07 Nov 2017 05:15:38 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 02cbad5  [flake8] Resolving F8?? errors (#3778)
02cbad5 is described below

commit 02cbad59de7de9c2eb042f1e422317879e475a5c
Author: John Bodley <4567245+john-bodley@users.noreply.github.com>
AuthorDate: Mon Nov 6 21:15:36 2017 -0800

    [flake8] Resolving F8?? errors (#3778)
---
 superset/views/core.py        |  2 +-
 tests/access_tests.py         | 16 ++++++----------
 tests/celery_tests.py         |  2 --
 tests/core_tests.py           | 10 +++++-----
 tests/db_engine_specs_test.py |  8 --------
 tests/druid_tests.py          |  4 ++--
 tests/viz_tests.py            |  4 ++--
 tox.ini                       |  2 --
 8 files changed, 16 insertions(+), 32 deletions(-)

diff --git a/superset/views/core.py b/superset/views/core.py
index 9e1d6ec..7c60f86 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -2057,7 +2057,7 @@ class Superset(BaseSupersetView):
             )
             query.status = utils.QueryStatus.STOPPED
             db.session.commit()
-        except Exception as e:
+        except Exception:
             pass
         return self.json_response('OK')
 
diff --git a/tests/access_tests.py b/tests/access_tests.py
index ec1ce74..8fa1fb5 100644
--- a/tests/access_tests.py
+++ b/tests/access_tests.py
@@ -8,7 +8,7 @@ import json
 import mock
 import unittest
 
-from superset import db, models, sm, security
+from superset import db, sm, security
 
 from superset.models import core as models
 from superset.connectors.connector_registry import ConnectorRegistry
@@ -204,7 +204,7 @@ class RequestAccessTests(SupersetTestCase):
         access_request1 = create_access_request(
             session, 'table', 'random_time_series', TEST_ROLE_1, 'gamma2')
         ds_1_id = access_request1.datasource_id
-        access_request2 = create_access_request(
+        create_access_request(
             session, 'table', 'random_time_series', TEST_ROLE_1, 'gamma')
         access_requests = self.get_access_requests('gamma', 'table', ds_1_id)
         self.assertTrue(access_requests)
@@ -229,7 +229,7 @@ class RequestAccessTests(SupersetTestCase):
 
         access_request1 = create_access_request(
             session, 'table', 'birth_names', TEST_ROLE_1, 'gamma')
-        access_request2 = create_access_request(
+        create_access_request(
             session, 'table', 'birth_names', TEST_ROLE_2, 'gamma2')
         ds_1_id = access_request1.datasource_id
         # gamma becomes alpha
@@ -258,7 +258,7 @@ class RequestAccessTests(SupersetTestCase):
         gamma_user = sm.find_user(username='gamma')
         access_request1 = create_access_request(
             session, 'table', 'long_lat', TEST_ROLE_1, 'gamma')
-        access_request2 = create_access_request(
+        create_access_request(
             session, 'table', 'long_lat', TEST_ROLE_2, 'gamma2')
         ds_1_id = access_request1.datasource_id
         # gamma gets granted database access
@@ -294,7 +294,7 @@ class RequestAccessTests(SupersetTestCase):
         gamma_user = sm.find_user(username='gamma')
         access_request1 = create_access_request(
             session, 'table', 'wb_health_population', TEST_ROLE_1, 'gamma')
-        access_request2 = create_access_request(
+        create_access_request(
             session, 'table', 'wb_health_population', TEST_ROLE_2, 'gamma2')
         ds_1_id = access_request1.datasource_id
         ds = session.query(SqlaTable).filter_by(
@@ -335,9 +335,8 @@ class RequestAccessTests(SupersetTestCase):
         access_request1 = create_access_request(
             session, 'table', 'unicode_test', TEST_ROLE_NAME, 'gamma')
         ds_1_id = access_request1.datasource_id
-        resp = self.get_resp(GRANT_ROLE_REQUEST.format(
+        self.get_resp(GRANT_ROLE_REQUEST.format(
             'table', ds_1_id, 'gamma', TEST_ROLE_NAME))
-
         # Test email content.
         self.assertTrue(mock_send_mime.called)
         call_args = mock_send_mime.call_args[0]
@@ -436,9 +435,6 @@ class RequestAccessTests(SupersetTestCase):
             'datasource_type={}&'
             'datasource_id={}&'
             'action={}&')
-        ROLE_EXTEND_LINK = (
-            '<a href="/superset/approve?datasource_type={}&datasource_id={}&'
-            'created_by={}&role_to_extend={}">Extend {} Role</a>')
         ROLE_GRANT_LINK = (
             '<a href="/superset/approve?datasource_type={}&datasource_id={}&'
             'created_by={}&role_to_grant={}">Grant {} Role</a>')
diff --git a/tests/celery_tests.py b/tests/celery_tests.py
index a479841..ce88caf 100644
--- a/tests/celery_tests.py
+++ b/tests/celery_tests.py
@@ -139,9 +139,7 @@ class CeleryTestCase(SupersetTestCase):
         return json.loads(resp.data.decode('utf-8'))
 
     def test_add_limit_to_the_query(self):
-        session = db.session
         main_db = self.get_main_database(db.session)
-        eng = main_db.get_sqla_engine()
 
         select_query = "SELECT * FROM outer_space;"
         updated_select_query = main_db.wrap_sql_limit(select_query, 100)
diff --git a/tests/core_tests.py b/tests/core_tests.py
index 3ff43d3..7d1b2fd 100644
--- a/tests/core_tests.py
+++ b/tests/core_tests.py
@@ -149,7 +149,7 @@ class CoreTests(SupersetTestCase):
             'slice_id': slice_id,
         }
         # Changing name and save as a new slice
-        resp = self.get_resp(
+        self.get_resp(
             url.format(
                 tbl_id,
                 copy_name,
@@ -170,7 +170,7 @@ class CoreTests(SupersetTestCase):
             'slice_id': new_slice_id,
         }
         # Setting the name back to its original name by overwriting new slice
-        resp = self.get_resp(
+        self.get_resp(
             url.format(
                 tbl_id,
                 new_slice_name,
@@ -353,7 +353,7 @@ class CoreTests(SupersetTestCase):
 
         try:
             resp = self.client.post('/kv/store/', data=dict())
-        except Exception as e:
+        except Exception:
             self.assertRaises(TypeError)
 
         value = json.dumps({'data': 'this is a test'})
@@ -370,7 +370,7 @@ class CoreTests(SupersetTestCase):
 
         try:
             resp = self.client.get('/kv/10001/')
-        except Exception as e:
+        except Exception:
             self.assertRaises(TypeError)
 
     def test_save_dash(self, username='admin'):
@@ -456,7 +456,7 @@ class CoreTests(SupersetTestCase):
             'dashboard_title': 'new title'
         }
         url = '/superset/save_dash/{}/'.format(dash.id)
-        resp = self.get_resp(url, data=dict(data=json.dumps(data)))
+        self.get_resp(url, data=dict(data=json.dumps(data)))
         updatedDash = (
             db.session.query(models.Dashboard)
                 .filter_by(slug="births")
diff --git a/tests/db_engine_specs_test.py b/tests/db_engine_specs_test.py
index a303813..67d5d0d 100644
--- a/tests/db_engine_specs_test.py
+++ b/tests/db_engine_specs_test.py
@@ -17,14 +17,6 @@ class DbEngineSpecsTestCase(unittest.TestCase):
         self.assertEquals(
             0, HiveEngineSpec.progress(log))
 
-    def test_0_progress(self):
-        log = """
-            17/02/07 18:26:27 INFO log.PerfLogger: <PERFLOG method=compile from=org.apache.hadoop.hive.ql.Driver>
-            17/02/07 18:26:27 INFO log.PerfLogger: <PERFLOG method=parse from=org.apache.hadoop.hive.ql.Driver>
-        """.split('\n')
-        self.assertEquals(
-            0, HiveEngineSpec.progress(log))
-
     def test_number_of_jobs_progress(self):
         log = """
             17/02/07 19:15:55 INFO ql.Driver: Total jobs = 2
diff --git a/tests/druid_tests.py b/tests/druid_tests.py
index d274691..c562c8d 100644
--- a/tests/druid_tests.py
+++ b/tests/druid_tests.py
@@ -76,7 +76,7 @@ class DruidTests(SupersetTestCase):
     def __init__(self, *args, **kwargs):
         super(DruidTests, self).__init__(*args, **kwargs)
 
-    @patch('superset.connectors.druid.models.PyDruid')
+    @patch('superset.connectors.druid.models.PyDruid')  # noqa ignore: F811
     def test_client(self, PyDruid):
         self.login(username='admin')
         instance = PyDruid.return_value
@@ -281,7 +281,7 @@ class DruidTests(SupersetTestCase):
         self.assertIn('datasource_for_gamma', resp)
         self.assertNotIn('datasource_not_for_gamma', resp)
 
-    @patch('superset.connectors.druid.models.PyDruid')
+    @patch('superset.connectors.druid.models.PyDruid')  # noqa ignore: F811
     def test_sync_druid_perm(self, PyDruid):
         self.login(username='admin')
         instance = PyDruid.return_value
diff --git a/tests/viz_tests.py b/tests/viz_tests.py
index 99111b5..3e97656 100644
--- a/tests/viz_tests.py
+++ b/tests/viz_tests.py
@@ -73,7 +73,7 @@ class BaseVizTestCase(unittest.TestCase):
         datasource.query = Mock(return_value=results)
         test_viz = viz.BaseViz(datasource, form_data)
         test_viz.get_fillna_for_columns = Mock(return_value=0)
-        result = test_viz.get_df(query_obj)
+        test_viz.get_df(query_obj)
         mock_call = df.__setitem__.mock_calls[0]
         self.assertEqual(mock_call[1][0], DTTM_ALIAS)
         self.assertFalse(mock_call[1][1].empty)
@@ -83,7 +83,7 @@ class BaseVizTestCase(unittest.TestCase):
         self.assertEqual(mock_call[1][1][0].hour, 6)
         self.assertEqual(mock_call[1][1].dtype, 'datetime64[ns]')
         mock_dttm_col.python_date_format = 'utc'
-        result = test_viz.get_df(query_obj)
+        test_viz.get_df(query_obj)
         mock_call = df.__setitem__.mock_calls[2]
         self.assertEqual(mock_call[1][0], DTTM_ALIAS)
         self.assertFalse(mock_call[1][1].empty)
diff --git a/tox.ini b/tox.ini
index fd75723..f3420a5 100644
--- a/tox.ini
+++ b/tox.ini
@@ -45,8 +45,6 @@ ignore =
     F401
     F403
     F405
-    F811
-    F841
     I100
     I101
     I201

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message