diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py index 1b71a75e04ff1..ef317c9a233e3 100644 --- a/superset/db_engine_specs.py +++ b/superset/db_engine_specs.py @@ -649,7 +649,7 @@ def latest_sub_partition(cls, table_name, schema, database, **kwargs): msg = ( "A filter needs to be specified for {} out of the " "{} fields." - ).format(len(part_fields)-1, len(part_fields)) + ).format(len(part_fields) - 1, len(part_fields)) raise SupersetTemplateException(msg) for field in part_fields: diff --git a/superset/views/core.py b/superset/views/core.py index ab2e3d434e96d..003115074cd02 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -1313,7 +1313,7 @@ def tables(self, db_id, schema, substr): max_tables = max_items * len(table_names) // total_items max_views = max_items * len(view_names) // total_items - table_options = [{'value': tn, 'label': tn} + table_options = [{'value': tn, 'label': tn} for tn in table_names[:max_tables]] table_options.extend([{'value': vn, 'label': '[view] {}'.format(vn)} for vn in view_names[:max_views]]) diff --git a/superset/viz.py b/superset/viz.py index ab66401f8a425..f53ccbbc2fecc 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -637,9 +637,9 @@ def get_data(self, df): elif domain == "week": range_ = diff_delta.years * 53 + diff_delta.weeks + 1 elif domain == "day": - range_ = diff_secs // (24*60*60) + 1 + range_ = diff_secs // (24 * 60 * 60) + 1 else: - range_ = diff_secs // (60*60) + 1 + range_ = diff_secs // (60 * 60) + 1 return { "timestamps": timestamps, @@ -1104,7 +1104,7 @@ def to_series(self, df, classed=''): {'x': ds, 'y': ys[ds] if ds in ys else None} for ds in df.index ], - "yAxis": i+1, + "yAxis": i + 1, "type": "line", } chart_data.append(d) diff --git a/tests/access_tests.py b/tests/access_tests.py index 1b950b5175734..8aa4c26206a57 100644 --- a/tests/access_tests.py +++ b/tests/access_tests.py @@ -268,7 +268,7 @@ def test_clean_requests_after_db_grant(self): ds_perm_view = sm.find_permission_view_menu( 'database_access', database.perm) sm.add_permission_role( - sm.find_role(DB_ACCESS_ROLE) , ds_perm_view) + sm.find_role(DB_ACCESS_ROLE), ds_perm_view) gamma_user.roles.append(sm.find_role(DB_ACCESS_ROLE)) session.commit() access_requests = self.get_access_requests('gamma', 'table', ds_1_id) @@ -306,7 +306,7 @@ def test_clean_requests_after_schema_grant(self): schema_perm_view = sm.find_permission_view_menu( 'schema_access', ds.schema_perm) sm.add_permission_role( - sm.find_role(SCHEMA_ACCESS_ROLE) , schema_perm_view) + sm.find_role(SCHEMA_ACCESS_ROLE), schema_perm_view) gamma_user.roles.append(sm.find_role(SCHEMA_ACCESS_ROLE)) session.commit() # gamma2 request gets fulfilled diff --git a/tests/celery_tests.py b/tests/celery_tests.py index 8763ec1d3e7a2..0debe66c3e6d7 100644 --- a/tests/celery_tests.py +++ b/tests/celery_tests.py @@ -275,8 +275,8 @@ def test_get_columns(self): {'is_date': True, 'type': 'STRING', 'name': 'string2', 'is_dim': False}, {'is_date': False, 'type': 'STRING', - 'name': 'string3', 'is_dim': True}], 'name') - , cols, + 'name': 'string3', 'is_dim': True}], 'name'), + cols, ) else: self.assertEqual(self.dictify_list_of_dicts([ @@ -295,8 +295,8 @@ def test_get_columns(self): {'is_date': True, 'type': 'STRING', 'name': 'string2', 'is_dim': False}, {'is_date': False, 'type': 'STRING', - 'name': 'string3', 'is_dim': True}], 'name') - , cols, + 'name': 'string3', 'is_dim': True}], 'name'), + cols, ) diff --git a/tests/db_engine_specs_test.py b/tests/db_engine_specs_test.py index 67d5d0d022a52..e348b90324a41 100644 --- a/tests/db_engine_specs_test.py +++ b/tests/db_engine_specs_test.py @@ -10,7 +10,7 @@ class DbEngineSpecsTestCase(unittest.TestCase): def test_0_progress(self): - log = """ + log = """ 17/02/07 18:26:27 INFO log.PerfLogger: 17/02/07 18:26:27 INFO log.PerfLogger: """.split('\n') diff --git a/tests/sqllab_tests.py b/tests/sqllab_tests.py index e0b670193bc21..c4332c982369d 100644 --- a/tests/sqllab_tests.py +++ b/tests/sqllab_tests.py @@ -111,7 +111,7 @@ def test_queries_endpoint(self): data = self.get_json_resp( '/superset/queries/{}'.format( - int(utils.datetime_to_epoch(now))-1000)) + int(utils.datetime_to_epoch(now)) - 1000)) self.assertEquals(1, len(data)) self.logout() @@ -149,7 +149,7 @@ def test_search_query_on_user(self): '/superset/search_queries?user_id={}'.format(user_id)) data = json.loads(resp) self.assertEquals(1, len(data)) - self.assertEquals(data[0]['userId'] , user_id) + self.assertEquals(data[0]['userId'], user_id) def test_search_query_on_status(self): self.run_some_queries() diff --git a/tests/viz_tests.py b/tests/viz_tests.py index 0aa0b6cc23b0c..4b97027284f95 100644 --- a/tests/viz_tests.py +++ b/tests/viz_tests.py @@ -104,7 +104,7 @@ def test_cache_timeout(self): self.assertEqual(156, test_viz.cache_timeout) datasource.cache_timeout = None datasource.database = Mock() - datasource.database.cache_timeout= 1666 + datasource.database.cache_timeout = 1666 self.assertEqual(1666, test_viz.cache_timeout) diff --git a/tox.ini b/tox.ini index b711dce38fd15..a810a4a5c6eaa 100644 --- a/tox.ini +++ b/tox.ini @@ -27,11 +27,6 @@ ignore = E127 E128 E131 - E203 - E221 - E225 - E226 - E241 E302 E303 E305