Skip to content

Commit

Permalink
[flake8] Resolving E2?? errors
Browse files Browse the repository at this point in the history
  • Loading branch information
John Bodley committed Nov 9, 2017
1 parent 0280bc5 commit 93f3e22
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion superset/db_engine_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]])
Expand Down
6 changes: 3 additions & 3 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/access_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/celery_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -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,
)


Expand Down
2 changes: 1 addition & 1 deletion tests/db_engine_specs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class DbEngineSpecsTestCase(unittest.TestCase):
def test_0_progress(self):
log = """
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')
Expand Down
4 changes: 2 additions & 2 deletions tests/sqllab_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/viz_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down
5 changes: 0 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ ignore =
E127
E128
E131
E203
E221
E225
E226
E241
E302
E303
E305
Expand Down

0 comments on commit 93f3e22

Please sign in to comment.