Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
New linting rules started applying, I'm guessing a new version of
pylint?
  • Loading branch information
mistercrunch committed Jan 3, 2018
1 parent 833649b commit 65be83b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 18 deletions.
5 changes: 3 additions & 2 deletions superset/connectors/druid/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ def _delete(self, pk):
icon='fa-cubes',
category='Sources',
category_label=__('Sources'),
category_icon='fa-database',)
category_icon='fa-database',
)


class DruidDatasourceModelView(DatasourceModelView, DeleteMixin, YamlExportMixin): # noqa
Expand Down Expand Up @@ -348,4 +349,4 @@ def scan_new_datasources(self):
icon='fa-cog')


appbuilder.add_separator('Sources', )
appbuilder.add_separator('Sources')
3 changes: 1 addition & 2 deletions superset/connectors/sqla/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ def values_for_column(self, column_name, limit=10000):

engine = self.database.get_sqla_engine()
sql = '{}'.format(
qry.compile(
engine, compile_kwargs={'literal_binds': True}, ),
qry.compile(engine, compile_kwargs={'literal_binds': True}),
)

df = pd.read_sql_query(sql=sql, con=engine)
Expand Down
3 changes: 2 additions & 1 deletion superset/connectors/sqla/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ def refresh(self, tables):
label=__('Tables'),
category='Sources',
category_label=__('Sources'),
icon='fa-table',)
icon='fa-table',
)

appbuilder.add_separator('Sources')
2 changes: 1 addition & 1 deletion superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def handle_error(msg):
limit=query.limit,
schema=database.force_ctas_schema,
show_cols=False,
latest_partition=False, ))
latest_partition=False))
query.end_time = utils.now_as_float()
session.merge(query)
session.flush()
Expand Down
14 changes: 7 additions & 7 deletions superset/views/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class DatabaseView(SupersetModelView, DeleteMixin, YamlExportMixin): # noqa
'allow_ctas', 'allow_dml', 'force_ctas_schema', 'impersonate_user']
search_exclude_columns = (
'password', 'tables', 'created_by', 'changed_by', 'queries',
'saved_queries', )
'saved_queries')
edit_columns = add_columns
show_columns = [
'tables',
Expand Down Expand Up @@ -281,7 +281,7 @@ def _delete(self, pk):
icon='fa-cloud-upload',
category='Manage',
category_label=__('Manage'),
category_icon='fa-wrench',)
category_icon='fa-wrench')


appbuilder.add_view(
Expand All @@ -291,7 +291,7 @@ def _delete(self, pk):
icon='fa-database',
category='Sources',
category_label=__('Sources'),
category_icon='fa-database',)
category_icon='fa-database')


class DatabaseAsync(DatabaseView):
Expand Down Expand Up @@ -400,7 +400,7 @@ class AccessRequestsModelView(SupersetModelView, DeleteMixin):
label=__('Access requests'),
category='Security',
category_label=__('Security'),
icon='fa-table',)
icon='fa-table')


class SliceModelView(SupersetModelView, DeleteMixin): # noqa
Expand Down Expand Up @@ -488,7 +488,7 @@ def add(self):
label=__('Charts'),
icon='fa-bar-chart',
category='',
category_icon='',)
category_icon='')


class SliceAsync(SliceModelView): # noqa
Expand Down Expand Up @@ -615,7 +615,7 @@ def download_dashboards(self):
label=__('Dashboards'),
icon='fa-dashboard',
category='',
category_icon='',)
category_icon='')


class DashboardModelViewAsync(DashboardModelView): # noqa
Expand Down Expand Up @@ -2594,7 +2594,7 @@ class CssTemplateAsyncModelView(CssTemplateModelView):
icon='fa-upload',
category='Sources',
category_label=__('Sources'),
category_icon='fa-wrench',)
category_icon='fa-wrench')
appbuilder.add_separator('Sources')


Expand Down
12 changes: 7 additions & 5 deletions tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,18 +833,20 @@ def test_import_csv(self):

def test_dataframe_timezone(self):
tz = psycopg2.tz.FixedOffsetTimezone(offset=60, name=None)
data = [(datetime.datetime(2017, 11, 18, 21, 53, 0, 219225, tzinfo=tz),),
(datetime.datetime(2017, 11, 18, 22, 6, 30, 61810, tzinfo=tz,),)]
data = [
(datetime.datetime(2017, 11, 18, 21, 53, 0, 219225, tzinfo=tz),),
(datetime.datetime(2017, 11, 18, 22, 6, 30, 61810, tzinfo=tz),),
]
df = dataframe.SupersetDataFrame(pd.DataFrame(data=list(data),
columns=['data', ]))
columns=['data']))
data = df.data
self.assertDictEqual(
data[0],
{'data': pd.Timestamp('2017-11-18 21:53:00.219225+0100', tz=tz), },
{'data': pd.Timestamp('2017-11-18 21:53:00.219225+0100', tz=tz)},
)
self.assertDictEqual(
data[1],
{'data': pd.Timestamp('2017-11-18 22:06:30.061810+0100', tz=tz), },
{'data': pd.Timestamp('2017-11-18 22:06:30.061810+0100', tz=tz)},
)


Expand Down

0 comments on commit 65be83b

Please sign in to comment.