mistercrunch closed pull request #3816: [flake8] Resolving E7?? errors
URL: https://github.com/apache/incubator-superset/pull/3816
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/setup.py b/setup.py
index 3ea155d0bc..fd953c470f 100644
--- a/setup.py
+++ b/setup.py
@@ -15,7 +15,7 @@ def get_git_sha():
try:
s = str(subprocess.check_output(['git', 'rev-parse', 'HEAD']))
return s.strip()
- except:
+ except Exception:
return ""
GIT_SHA = get_git_sha()
diff --git a/superset/config.py b/superset/config.py
index c78595c561..c2c9df95f6 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -338,7 +338,7 @@ class CeleryConfig(object):
# Provide a callable that receives a tracking_url and returns another
# URL. This is used to translate internal Hadoop job tracker URL
# into a proxied one
-TRACKING_URL_TRANSFORMER = lambda x: x
+TRACKING_URL_TRANSFORMER = lambda x: x # noqa: E731
try:
if CONFIG_PATH_ENV_VAR in os.environ:
diff --git a/superset/connectors/sqla/models.py
b/superset/connectors/sqla/models.py
index 67734114e2..03fac8eb2c 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -58,7 +58,7 @@ def sqla_col(self):
def get_time_filter(self, start_dttm, end_dttm):
col = self.sqla_col.label('__time')
- l = []
+ l = [] # noqa: E741
if start_dttm:
l.append(col >= text(self.dttm_sql_literal(start_dttm)))
if end_dttm:
@@ -228,7 +228,7 @@ def full_name(self):
@property
def dttm_cols(self):
- l = [c.column_name for c in self.columns if c.is_dttm]
+ l = [c.column_name for c in self.columns if c.is_dttm] # noqa: E741
if self.main_dttm_col and self.main_dttm_col not in l:
l.append(self.main_dttm_col)
return l
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index ef317c9a23..2c2ad0b4d0 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -380,7 +380,7 @@ def extract_error_message(cls, e):
try:
if isinstance(e.args, tuple) and len(e.args) > 1:
message = e.args[1]
- except:
+ except Exception:
pass
return message
@@ -555,14 +555,14 @@ def _partition_query(
limit_clause = "LIMIT {}".format(limit) if limit else ''
order_by_clause = ''
if order_by:
- l = []
+ l = [] # noqa: E741
for field, desc in order_by:
l.append(field + ' DESC' if desc else '')
order_by_clause = 'ORDER BY ' + ', '.join(l)
where_clause = ''
if filters:
- l = []
+ l = [] # noqa: E741
for field, value in filters.items():
l.append("{field} = '{value}'".format(**locals()))
where_clause = 'WHERE ' + ' AND '.join(l)
@@ -728,7 +728,7 @@ def adjust_database_uri(cls, uri, selected_schema=None):
def extract_error_message(cls, e):
try:
msg = e.message.status.errorMessage
- except:
+ except Exception:
msg = str(e)
return msg
diff --git a/superset/models/core.py b/superset/models/core.py
index d2ca844f27..fdeea6b143 100644
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -849,7 +849,7 @@ def wrapper(*args, **kwargs):
params = ""
try:
params = json.dumps(d)
- except:
+ except Exception:
pass
stats_logger.incr(f.__name__)
value = f(*args, **kwargs)
diff --git a/superset/views/core.py b/superset/views/core.py
index 003115074c..5d8d7034d3 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -1953,7 +1953,7 @@ def table(self, database_id, table_name, schema):
dtype = ""
try:
dtype = '{}'.format(col['type'])
- except:
+ except Exception:
pass
cols.append({
'name': col['name'],
diff --git a/superset/viz.py b/superset/viz.py
index f53ccbbc2f..4a5bc1fc26 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1243,7 +1243,7 @@ def get_data(self, df):
elif len(self.metrics) > 1:
series_title = ", ".join(name)
else:
- l = [str(s) for s in name[1:]]
+ l = [str(s) for s in name[1:]] # noqa: E741
series_title = ", ".join(l)
values = []
for i, v in ys.iteritems():
diff --git a/tests/core_tests.py b/tests/core_tests.py
index c7c2ff9a16..9e26a80c7d 100644
--- a/tests/core_tests.py
+++ b/tests/core_tests.py
@@ -765,7 +765,7 @@ def test_slice_query_endpoint(self):
resp = self.get_resp('/superset/slice_query/{}/'.format(slc.id))
assert 'query' in resp
assert 'language' in resp
- self.logout();
+ self.logout()
def test_viz_get_fillna_for_columns(self):
slc = self.get_slice("Girls", db.session)
diff --git a/tests/import_export_tests.py b/tests/import_export_tests.py
index d0b8c101c8..8bc706a06c 100644
--- a/tests/import_export_tests.py
+++ b/tests/import_export_tests.py
@@ -247,7 +247,7 @@ def test_export_2_dashboards(self):
self.get_table_by_name('wb_health_population'), exported_tables[1])
def test_import_1_slice(self):
- expected_slice = self.create_slice('Import Me', id=10001);
+ expected_slice = self.create_slice('Import Me', id=10001)
slc_id = models.Slice.import_obj(expected_slice, import_time=1989)
slc = self.get_slice(slc_id)
self.assertEquals(slc.datasource.perm, slc.perm)
diff --git a/tests/viz_tests.py b/tests/viz_tests.py
index 416cf3976c..f21434dfa9 100644
--- a/tests/viz_tests.py
+++ b/tests/viz_tests.py
@@ -22,7 +22,7 @@ def test_get_fillna_returns_default_on_null_columns(self):
'token': '12345',
}
datasource = {'type': 'table'}
- test_viz = viz.BaseViz(datasource, form_data);
+ test_viz = viz.BaseViz(datasource, form_data)
self.assertEqual(
test_viz.default_fillna,
test_viz.get_fillna_for_columns(),
diff --git a/tox.ini b/tox.ini
index 66ddc8021c..272d541c61 100644
--- a/tox.ini
+++ b/tox.ini
@@ -33,10 +33,6 @@ ignore =
E306
E402
E501
- E722
- E703
- E731
- E741
Q000
Q001
import-order-style = google
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services