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: Some linting (#5790)
Date Thu, 20 Sep 2018 15:11:53 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 5b97fe5  Some linting (#5790)
5b97fe5 is described below

commit 5b97fe5c0cf42a653e43b312405e555655d22eb6
Author: Maxime Beauchemin <maximebeauchemin@gmail.com>
AuthorDate: Thu Sep 20 08:11:43 2018 -0700

    Some linting (#5790)
---
 .../sqllab/ExploreResultsButton_spec.jsx           |  14 --
 .../src/SqlLab/components/ExploreResultsButton.jsx |   3 -
 .../assets/src/dashboard/components/Header.jsx     |   1 -
 .../assets/src/datasource/DatasourceEditor.jsx     |   5 -
 superset/assets/src/datasource/DatasourceModal.jsx |   7 -
 .../components/controls/DatasourceControl.jsx      |   4 -
 ...9ee0e3_fix_wrong_constraint_on_table_columns.py |   4 +
 .../versions/130915240929_is_sqllab_viz_flow.py    |   4 +
 .../versions/18e88e1cc004_making_audit_nullable.py | 153 ++++++++++++---------
 .../migrations/versions/1d2ddd543133_log_dt.py     |   4 +
 superset/migrations/versions/1d9e835a84f9_.py      |  26 ++--
 .../versions/21e88bc06c02_annotation_migration.py  |   4 +
 .../289ce07647b_add_encrypted_password_field.py    |   4 +
 .../versions/2fcdcb35e487_saved_queries.py         |   4 +
 .../versions/33d996bcc382_update_slice_model.py    |   4 +
 .../41f6a59a61f2_database_options_for_sql_lab.py   |   4 +
 .../migrations/versions/430039611635_log_more.py   |   9 +-
 .../versions/4fa88fe24e94_owners_many_to_many.py   |   4 +
 superset/migrations/versions/5ccf602336a0_.py      |   4 +
 superset/migrations/versions/6414e83d82b7_.py      |   4 +
 superset/migrations/versions/705732c70154_.py      |   4 +
 superset/migrations/versions/7fcdcde0761c_.py      |  11 +-
 .../versions/836c0bf75904_cache_timeouts.py        |   4 +
 ...4f117f9_adding_extra_field_to_database_model.py |   4 +
 superset/migrations/versions/8e80a26a31db_.py      |   4 +
 .../versions/956a063c52b3_adjusting_key_length.py  |  10 +-
 .../a6c18f869a4e_query_start_running_time.py       |  14 +-
 .../a9c47e2c1547_add_impersonate_user_to_dbs.py    |   4 +
 superset/migrations/versions/b347b202819b_.py      |   4 +
 .../b4456560d4f3_change_table_unique_constraint.py |   7 +-
 .../bebcf3fed1fe_convert_dashboard_v1_positions.py |  45 +++---
 .../bf706ae5eb46_cal_heatmap_metric_to_metrics.py  |  10 +-
 superset/migrations/versions/c18bd4186f15_.py      |   3 -
 .../c3a8f8611885_materializing_permission.py       |  19 ++-
 superset/migrations/versions/c9495751e314_.py      |   4 +
 superset/migrations/versions/d6db5a5cdb5d_.py      |   4 +
 .../versions/e46f2d27a08e_materialize_perms.py     |   4 +
 superset/migrations/versions/ec1f88a35cc6_.py      |   3 -
 superset/migrations/versions/ef8843b41dac_.py      |   7 +-
 39 files changed, 264 insertions(+), 167 deletions(-)

diff --git a/superset/assets/spec/javascripts/sqllab/ExploreResultsButton_spec.jsx b/superset/assets/spec/javascripts/sqllab/ExploreResultsButton_spec.jsx
index 98972ff..6d78929 100644
--- a/superset/assets/spec/javascripts/sqllab/ExploreResultsButton_spec.jsx
+++ b/superset/assets/spec/javascripts/sqllab/ExploreResultsButton_spec.jsx
@@ -93,20 +93,6 @@ describe('ExploreResultsButton', () => {
     expect(wrapper.find(Button)).to.have.length(1);
   });
 
-  describe('getColumnFromProps', () => {
-    it('should require valid query parameter in props', () => {
-      const emptyQuery = {
-        database,
-        show: true,
-        query: {},
-      };
-      const wrapper = shallow(<ExploreResultsButton {...emptyQuery} />, {
-        context: { store },
-      }).dive();
-      expect(wrapper.state().hints).to.deep.equal([]);
-    });
-  });
-
   describe('datasourceName', () => {
     let wrapper;
     let stub;
diff --git a/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx b/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
index 40cf1ec..207ac4c 100644
--- a/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
+++ b/superset/assets/src/SqlLab/components/ExploreResultsButton.jsx
@@ -27,9 +27,6 @@ const defaultProps = {
 class ExploreResultsButton extends React.PureComponent {
   constructor(props) {
     super(props);
-    this.state = {
-      hints: [],
-    };
     this.visualize = this.visualize.bind(this);
     this.onClick = this.onClick.bind(this);
     this.getInvalidColumns = this.getInvalidColumns.bind(this);
diff --git a/superset/assets/src/dashboard/components/Header.jsx b/superset/assets/src/dashboard/components/Header.jsx
index bc66a01..dd2af7f 100644
--- a/superset/assets/src/dashboard/components/Header.jsx
+++ b/superset/assets/src/dashboard/components/Header.jsx
@@ -62,7 +62,6 @@ class Header extends React.PureComponent {
     this.state = {
       didNotifyMaxUndoHistoryToast: false,
       emphasizeUndo: false,
-      hightlightRedo: false,
     };
 
     this.handleChangeText = this.handleChangeText.bind(this);
diff --git a/superset/assets/src/datasource/DatasourceEditor.jsx b/superset/assets/src/datasource/DatasourceEditor.jsx
index 4d56b46..5ffb7a6 100644
--- a/superset/assets/src/datasource/DatasourceEditor.jsx
+++ b/superset/assets/src/datasource/DatasourceEditor.jsx
@@ -189,7 +189,6 @@ export class DatasourceEditor extends React.PureComponent {
     super(props);
     this.state = {
       datasource: props.datasource,
-      showAlert: true,
       errors: [],
       isDruid: props.datasource.type === 'druid',
       isSqla: props.datasource.type === 'table',
@@ -202,7 +201,6 @@ export class DatasourceEditor extends React.PureComponent {
     this.onChange = this.onChange.bind(this);
     this.onDatasourcePropChange = this.onDatasourcePropChange.bind(this);
     this.onDatasourceChange = this.onDatasourceChange.bind(this);
-    this.hideAlert = this.hideAlert.bind(this);
     this.syncMetadata = this.syncMetadata.bind(this);
     this.setColumns = this.setColumns.bind(this);
     this.validateAndChange = this.validateAndChange.bind(this);
@@ -307,9 +305,6 @@ export class DatasourceEditor extends React.PureComponent {
 
     this.setState({ errors }, callback);
   }
-  hideAlert() {
-    this.setState({ showAlert: false });
-  }
   handleTabSelect(activeTabKey) {
     this.setState({ activeTabKey });
   }
diff --git a/superset/assets/src/datasource/DatasourceModal.jsx b/superset/assets/src/datasource/DatasourceModal.jsx
index 2f3dbdc..915010b 100644
--- a/superset/assets/src/datasource/DatasourceModal.jsx
+++ b/superset/assets/src/datasource/DatasourceModal.jsx
@@ -29,15 +29,11 @@ class DatasourceModal extends React.PureComponent {
   constructor(props) {
     super(props);
     this.state = {
-      showEditDatasource: false,
-      filter: '',
-      loading: true,
       errors: [],
       showDatasource: false,
       datasource: props.datasource,
     };
     this.toggleShowDatasource = this.toggleShowDatasource.bind(this);
-    this.changeSearch = this.changeSearch.bind(this);
     this.setSearchRef = this.setSearchRef.bind(this);
     this.onDatasourceChange = this.onDatasourceChange.bind(this);
     this.onClickSave = this.onClickSave.bind(this);
@@ -98,9 +94,6 @@ class DatasourceModal extends React.PureComponent {
   toggleShowDatasource() {
     this.setState({ showDatasource: !this.state.showDatasource });
   }
-  changeSearch(event) {
-    this.setState({ filter: event.target.value });
-  }
   renderSaveDialog() {
     return (
       <div>
diff --git a/superset/assets/src/explore/components/controls/DatasourceControl.jsx b/superset/assets/src/explore/components/controls/DatasourceControl.jsx
index 5392218..69f398d 100644
--- a/superset/assets/src/explore/components/controls/DatasourceControl.jsx
+++ b/superset/assets/src/explore/components/controls/DatasourceControl.jsx
@@ -37,7 +37,6 @@ class DatasourceControl extends React.PureComponent {
     super(props);
     this.state = {
       showEditDatasourceModal: false,
-      filter: '',
       loading: true,
       showDatasource: false,
     };
@@ -95,9 +94,6 @@ class DatasourceControl extends React.PureComponent {
   toggleModal() {
     this.setState({ showModal: !this.state.showModal });
   }
-  changeSearch(event) {
-    this.setState({ filter: event.target.value });
-  }
   selectDatasource(datasourceId) {
     this.setState({ showModal: false });
     this.props.onChange(datasourceId);
diff --git a/superset/migrations/versions/1226819ee0e3_fix_wrong_constraint_on_table_columns.py
b/superset/migrations/versions/1226819ee0e3_fix_wrong_constraint_on_table_columns.py
index a3279ca..f5d940c 100644
--- a/superset/migrations/versions/1226819ee0e3_fix_wrong_constraint_on_table_columns.py
+++ b/superset/migrations/versions/1226819ee0e3_fix_wrong_constraint_on_table_columns.py
@@ -6,6 +6,10 @@ Revises: 956a063c52b3
 Create Date: 2016-05-27 15:03:32.980343
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = '1226819ee0e3'
diff --git a/superset/migrations/versions/130915240929_is_sqllab_viz_flow.py b/superset/migrations/versions/130915240929_is_sqllab_viz_flow.py
index 4d8554c..9e95c7a 100644
--- a/superset/migrations/versions/130915240929_is_sqllab_viz_flow.py
+++ b/superset/migrations/versions/130915240929_is_sqllab_viz_flow.py
@@ -5,6 +5,10 @@ Revises: f231d82b9b26
 Create Date: 2018-04-03 08:19:34.098789
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 from alembic import op
 import sqlalchemy as sa
 from sqlalchemy.ext.declarative import declarative_base
diff --git a/superset/migrations/versions/18e88e1cc004_making_audit_nullable.py b/superset/migrations/versions/18e88e1cc004_making_audit_nullable.py
index 3bb6600..0696290 100644
--- a/superset/migrations/versions/18e88e1cc004_making_audit_nullable.py
+++ b/superset/migrations/versions/18e88e1cc004_making_audit_nullable.py
@@ -6,14 +6,18 @@ Revises: 430039611635
 Create Date: 2016-03-13 21:30:24.833107
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from alembic import op
+import sqlalchemy as sa
 
 # revision identifiers, used by Alembic.
 revision = '18e88e1cc004'
 down_revision = '430039611635'
 
-from alembic import op
-import sqlalchemy as sa
-
 
 def upgrade():
     try:
@@ -30,69 +34,88 @@ def upgrade():
         op.drop_column('columns', 'created_by_fk')
         op.drop_column('columns', 'changed_on')
         op.drop_column('columns', 'changed_by_fk')
-        op.alter_column('css_templates', 'changed_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('css_templates', 'created_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('dashboards', 'changed_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('dashboards', 'created_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
+        op.alter_column(
+            'css_templates', 'changed_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'css_templates', 'created_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'dashboards', 'changed_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'dashboards', 'created_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
         op.create_unique_constraint(None, 'dashboards', ['slug'])
-        op.alter_column('datasources', 'changed_by_fk',
-                   existing_type=sa.INTEGER(),
-                   nullable=True)
-        op.alter_column('datasources', 'changed_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('datasources', 'created_by_fk',
-                   existing_type=sa.INTEGER(),
-                   nullable=True)
-        op.alter_column('datasources', 'created_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('dbs', 'changed_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('dbs', 'created_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('slices', 'changed_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('slices', 'created_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('sql_metrics', 'changed_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('sql_metrics', 'created_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('table_columns', 'changed_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('table_columns', 'created_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('tables', 'changed_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('tables', 'created_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('url', 'changed_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        op.alter_column('url', 'created_on',
-                   existing_type=sa.DATETIME(),
-                   nullable=True)
-        ### end Alembic commands ###
-    except:
+        op.alter_column(
+            'datasources', 'changed_by_fk',
+            existing_type=sa.INTEGER(),
+            nullable=True)
+        op.alter_column(
+            'datasources', 'changed_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'datasources', 'created_by_fk',
+            existing_type=sa.INTEGER(),
+            nullable=True)
+        op.alter_column(
+            'datasources', 'created_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'dbs', 'changed_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'dbs', 'created_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'slices', 'changed_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'slices', 'created_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'sql_metrics', 'changed_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'sql_metrics', 'created_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'table_columns', 'changed_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'table_columns', 'created_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'tables', 'changed_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'tables', 'created_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'url', 'changed_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+        op.alter_column(
+            'url', 'created_on',
+            existing_type=sa.DATETIME(),
+            nullable=True)
+    except Exception:
         pass
 
 
diff --git a/superset/migrations/versions/1d2ddd543133_log_dt.py b/superset/migrations/versions/1d2ddd543133_log_dt.py
index 70cda0a..e468150 100644
--- a/superset/migrations/versions/1d2ddd543133_log_dt.py
+++ b/superset/migrations/versions/1d2ddd543133_log_dt.py
@@ -6,6 +6,10 @@ Revises: d2424a248d63
 Create Date: 2016-03-25 14:35:44.642576
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = '1d2ddd543133'
diff --git a/superset/migrations/versions/1d9e835a84f9_.py b/superset/migrations/versions/1d9e835a84f9_.py
index 0a5a63f..4120788 100644
--- a/superset/migrations/versions/1d9e835a84f9_.py
+++ b/superset/migrations/versions/1d9e835a84f9_.py
@@ -5,25 +5,29 @@ Revises: 3dda56f1c4c6
 Create Date: 2018-07-16 18:04:07.764659
 
 """
-
-# revision identifiers, used by Alembic.
-revision = '1d9e835a84f9'
-down_revision = '3dda56f1c4c6'
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 from alembic import op
 import sqlalchemy as sa
 from sqlalchemy.sql import expression
 
+# revision identifiers, used by Alembic.
+revision = '1d9e835a84f9'
+down_revision = '3dda56f1c4c6'
+
 
 def upgrade():
     op.add_column(
-    	'dbs',
-    	sa.Column(
-    		'allow_csv_upload',
-    		sa.Boolean(),
-    		nullable=False,
-    		server_default=expression.true()))
+        'dbs',
+        sa.Column(
+            'allow_csv_upload',
+            sa.Boolean(),
+            nullable=False,
+            server_default=expression.true()))
+
 
 def downgrade():
     op.drop_column('dbs', 'allow_csv_upload')
- 
\ No newline at end of file
diff --git a/superset/migrations/versions/21e88bc06c02_annotation_migration.py b/superset/migrations/versions/21e88bc06c02_annotation_migration.py
index 9a0e407..3d53d16 100644
--- a/superset/migrations/versions/21e88bc06c02_annotation_migration.py
+++ b/superset/migrations/versions/21e88bc06c02_annotation_migration.py
@@ -1,4 +1,8 @@
 # -*- coding: utf-8 -*-
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 import json
 
 from alembic import op
diff --git a/superset/migrations/versions/289ce07647b_add_encrypted_password_field.py b/superset/migrations/versions/289ce07647b_add_encrypted_password_field.py
index 56fa53a..cd5c108 100644
--- a/superset/migrations/versions/289ce07647b_add_encrypted_password_field.py
+++ b/superset/migrations/versions/289ce07647b_add_encrypted_password_field.py
@@ -6,6 +6,10 @@ Revises: 2929af7925ed
 Create Date: 2015-11-21 11:18:00.650587
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 from alembic import op
 import sqlalchemy as sa
diff --git a/superset/migrations/versions/2fcdcb35e487_saved_queries.py b/superset/migrations/versions/2fcdcb35e487_saved_queries.py
index 629cc76..da276cc 100644
--- a/superset/migrations/versions/2fcdcb35e487_saved_queries.py
+++ b/superset/migrations/versions/2fcdcb35e487_saved_queries.py
@@ -6,6 +6,10 @@ Revises: a6c18f869a4e
 Create Date: 2017-03-29 15:04:35.734190
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 from alembic import op
 import sqlalchemy as sa
diff --git a/superset/migrations/versions/33d996bcc382_update_slice_model.py b/superset/migrations/versions/33d996bcc382_update_slice_model.py
index 28ef831..ad70507 100644
--- a/superset/migrations/versions/33d996bcc382_update_slice_model.py
+++ b/superset/migrations/versions/33d996bcc382_update_slice_model.py
@@ -1,4 +1,8 @@
 # -*- coding: utf-8 -*-
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 from alembic import op
 import sqlalchemy as sa
 from superset import db
diff --git a/superset/migrations/versions/41f6a59a61f2_database_options_for_sql_lab.py b/superset/migrations/versions/41f6a59a61f2_database_options_for_sql_lab.py
index 484d093..70c5253 100644
--- a/superset/migrations/versions/41f6a59a61f2_database_options_for_sql_lab.py
+++ b/superset/migrations/versions/41f6a59a61f2_database_options_for_sql_lab.py
@@ -6,6 +6,10 @@ Revises: 3c3ffe173e4f
 Create Date: 2016-08-31 10:26:37.969107
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 from alembic import op
 import sqlalchemy as sa
 
diff --git a/superset/migrations/versions/430039611635_log_more.py b/superset/migrations/versions/430039611635_log_more.py
index 6b8cbb3..dcc40f0 100644
--- a/superset/migrations/versions/430039611635_log_more.py
+++ b/superset/migrations/versions/430039611635_log_more.py
@@ -6,13 +6,18 @@ Revises: d827694c7555
 Create Date: 2016-02-10 08:47:28.950891
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from alembic import op
+import sqlalchemy as sa
 
 # revision identifiers, used by Alembic.
 revision = '430039611635'
 down_revision = 'd827694c7555'
 
-from alembic import op
-import sqlalchemy as sa
 
 def upgrade():
     op.add_column('logs', sa.Column('dashboard_id', sa.Integer(), nullable=True))
diff --git a/superset/migrations/versions/4fa88fe24e94_owners_many_to_many.py b/superset/migrations/versions/4fa88fe24e94_owners_many_to_many.py
index b8601e1..fd4e711 100644
--- a/superset/migrations/versions/4fa88fe24e94_owners_many_to_many.py
+++ b/superset/migrations/versions/4fa88fe24e94_owners_many_to_many.py
@@ -6,6 +6,10 @@ Revises: b4456560d4f3
 Create Date: 2016-04-15 17:58:33.842012
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = '4fa88fe24e94'
diff --git a/superset/migrations/versions/5ccf602336a0_.py b/superset/migrations/versions/5ccf602336a0_.py
index 540c5fc..16cdd55 100644
--- a/superset/migrations/versions/5ccf602336a0_.py
+++ b/superset/migrations/versions/5ccf602336a0_.py
@@ -5,6 +5,10 @@ Revises: ('130915240929', 'c9495751e314')
 Create Date: 2018-04-12 16:00:47.639218
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = '5ccf602336a0'
diff --git a/superset/migrations/versions/6414e83d82b7_.py b/superset/migrations/versions/6414e83d82b7_.py
index ed1edec..c0c2bc6 100644
--- a/superset/migrations/versions/6414e83d82b7_.py
+++ b/superset/migrations/versions/6414e83d82b7_.py
@@ -6,6 +6,10 @@ Revises: ('525c854f0005', 'f1f2d4af5b90')
 Create Date: 2016-12-19 09:57:05.814013
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = '6414e83d82b7'
diff --git a/superset/migrations/versions/705732c70154_.py b/superset/migrations/versions/705732c70154_.py
index 212f69a..b1cefd3 100644
--- a/superset/migrations/versions/705732c70154_.py
+++ b/superset/migrations/versions/705732c70154_.py
@@ -5,6 +5,10 @@ Revises: ('4451805bbaa1', '1d9e835a84f9')
 Create Date: 2018-07-22 21:51:19.235558
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = '705732c70154'
diff --git a/superset/migrations/versions/7fcdcde0761c_.py b/superset/migrations/versions/7fcdcde0761c_.py
index 793e0fb..ad87fca 100644
--- a/superset/migrations/versions/7fcdcde0761c_.py
+++ b/superset/migrations/versions/7fcdcde0761c_.py
@@ -12,12 +12,7 @@ import re
 
 from alembic import op
 import sqlalchemy as sa
-from sqlalchemy import (
-    Table, Column,
-    Integer, String, Text, ForeignKey,
-)
 from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy.orm import relationship
 
 from superset import db
 
@@ -31,7 +26,7 @@ class Dashboard(Base):
     """Declarative class to do query in upgrade"""
     __tablename__ = 'dashboards'
     id = sa.Column(sa.Integer, primary_key=True)
-    dashboard_title = sa.Column(String(500))
+    dashboard_title = sa.Column(sa.String(500))
     position_json = sa.Column(sa.Text)
 
 
@@ -59,8 +54,8 @@ def upgrade():
             text = text.replace('_TYPE', '')
 
             dashboard.position_json = text
-            print('dash id:{} position_json size from {} to {}'
-                .format(dashboard.id, len(original_text), len(text)))
+            print('dash id:{} position_json size from {} to {}'.format(
+                dashboard.id, len(original_text), len(text)))
             session.merge(dashboard)
             session.commit()
 
diff --git a/superset/migrations/versions/836c0bf75904_cache_timeouts.py b/superset/migrations/versions/836c0bf75904_cache_timeouts.py
index b5e5d47..8b65ef9 100644
--- a/superset/migrations/versions/836c0bf75904_cache_timeouts.py
+++ b/superset/migrations/versions/836c0bf75904_cache_timeouts.py
@@ -6,6 +6,10 @@ Revises: 18e88e1cc004
 Create Date: 2016-03-17 08:40:03.186534
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = '836c0bf75904'
diff --git a/superset/migrations/versions/867bf4f117f9_adding_extra_field_to_database_model.py
b/superset/migrations/versions/867bf4f117f9_adding_extra_field_to_database_model.py
index 8681854..f4e44b3 100644
--- a/superset/migrations/versions/867bf4f117f9_adding_extra_field_to_database_model.py
+++ b/superset/migrations/versions/867bf4f117f9_adding_extra_field_to_database_model.py
@@ -6,6 +6,10 @@ Revises: fee7b758c130
 Create Date: 2016-04-03 15:23:20.280841
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = '867bf4f117f9'
diff --git a/superset/migrations/versions/8e80a26a31db_.py b/superset/migrations/versions/8e80a26a31db_.py
index b80c82d..1117601 100644
--- a/superset/migrations/versions/8e80a26a31db_.py
+++ b/superset/migrations/versions/8e80a26a31db_.py
@@ -6,6 +6,10 @@ Revises: 2591d77e9831
 Create Date: 2016-01-13 20:24:45.256437
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = '8e80a26a31db'
diff --git a/superset/migrations/versions/956a063c52b3_adjusting_key_length.py b/superset/migrations/versions/956a063c52b3_adjusting_key_length.py
index 843433e..89f4609 100644
--- a/superset/migrations/versions/956a063c52b3_adjusting_key_length.py
+++ b/superset/migrations/versions/956a063c52b3_adjusting_key_length.py
@@ -6,14 +6,18 @@ Revises: f0fbf6129e13
 Create Date: 2016-05-11 17:28:32.407340
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from alembic import op
+import sqlalchemy as sa
 
 # revision identifiers, used by Alembic.
 revision = '956a063c52b3'
 down_revision = 'f0fbf6129e13'
 
-from alembic import op
-import sqlalchemy as sa
-
 
 def upgrade():
     with op.batch_alter_table('clusters', schema=None) as batch_op:
diff --git a/superset/migrations/versions/a6c18f869a4e_query_start_running_time.py b/superset/migrations/versions/a6c18f869a4e_query_start_running_time.py
index 53b4fcb..b41a525 100644
--- a/superset/migrations/versions/a6c18f869a4e_query_start_running_time.py
+++ b/superset/migrations/versions/a6c18f869a4e_query_start_running_time.py
@@ -6,6 +6,11 @@ Revises: 979c03af3341
 Create Date: 2017-03-28 11:28:41.387182
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
 from alembic import op
 import sqlalchemy as sa
 
@@ -17,9 +22,12 @@ down_revision = '979c03af3341'
 def upgrade():
     op.add_column(
         'query',
-        sa.Column('start_running_time',
-        sa.Numeric(precision=20, scale=6),
-        nullable=True))
+        sa.Column(
+            'start_running_time',
+            sa.Numeric(precision=20, scale=6),
+            nullable=True,
+        ),
+    )
 
 
 def downgrade():
diff --git a/superset/migrations/versions/a9c47e2c1547_add_impersonate_user_to_dbs.py b/superset/migrations/versions/a9c47e2c1547_add_impersonate_user_to_dbs.py
index 5bc1222..c0961d2 100644
--- a/superset/migrations/versions/a9c47e2c1547_add_impersonate_user_to_dbs.py
+++ b/superset/migrations/versions/a9c47e2c1547_add_impersonate_user_to_dbs.py
@@ -6,6 +6,10 @@ Revises: ca69c70ec99b
 Create Date: 2017-08-31 17:35:58.230723
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = 'a9c47e2c1547'
diff --git a/superset/migrations/versions/b347b202819b_.py b/superset/migrations/versions/b347b202819b_.py
index a55eed1..26e5c20 100644
--- a/superset/migrations/versions/b347b202819b_.py
+++ b/superset/migrations/versions/b347b202819b_.py
@@ -6,6 +6,10 @@ Revises: ('33d996bcc382', '65903709c321')
 Create Date: 2016-09-19 17:22:40.138601
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = 'b347b202819b'
diff --git a/superset/migrations/versions/b4456560d4f3_change_table_unique_constraint.py b/superset/migrations/versions/b4456560d4f3_change_table_unique_constraint.py
index 157c322..4b0613d 100644
--- a/superset/migrations/versions/b4456560d4f3_change_table_unique_constraint.py
+++ b/superset/migrations/versions/b4456560d4f3_change_table_unique_constraint.py
@@ -6,13 +6,16 @@ Revises: bb51420eaf83
 Create Date: 2016-04-15 08:31:26.249591
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+from alembic import op
 
 # revision identifiers, used by Alembic.
 revision = 'b4456560d4f3'
 down_revision = 'bb51420eaf83'
 
-from alembic import op
-
 
 def upgrade():
     try:
diff --git a/superset/migrations/versions/bebcf3fed1fe_convert_dashboard_v1_positions.py b/superset/migrations/versions/bebcf3fed1fe_convert_dashboard_v1_positions.py
index 5767401..03811b0 100644
--- a/superset/migrations/versions/bebcf3fed1fe_convert_dashboard_v1_positions.py
+++ b/superset/migrations/versions/bebcf3fed1fe_convert_dashboard_v1_positions.py
@@ -8,16 +8,19 @@ Create Date: 2018-07-22 11:59:07.025119
 
 # revision identifiers, used by Alembic.
 import collections
+from functools import reduce
 import json
 import sys
-from functools import reduce
 import uuid
 
 from alembic import op
-import sqlalchemy as sa
 from sqlalchemy import (
-    Table, Column,
-    Integer, String, Text, ForeignKey,
+    Column,
+    ForeignKey,
+    Integer,
+    String,
+    Table,
+    Text,
 )
 from sqlalchemy.ext.declarative import declarative_base
 from sqlalchemy.orm import relationship
@@ -74,9 +77,9 @@ dashboard_slices = Table(
 class Dashboard(Base):
     """Declarative class to do query in upgrade"""
     __tablename__ = 'dashboards'
-    id = sa.Column(sa.Integer, primary_key=True)
-    dashboard_title = sa.Column(String(500))
-    position_json = sa.Column(sa.Text)
+    id = Column(Integer, primary_key=True)
+    dashboard_title = Column(String(500))
+    position_json = Column(Text)
     slices = relationship(
         'Slice', secondary=dashboard_slices, backref='dashboards')
 
@@ -189,11 +192,11 @@ def get_chart_holder(position):
 
     width = max(
         GRID_MIN_COLUMN_COUNT,
-        int(round(size_x / GRID_RATIO))
+        int(round(size_x / GRID_RATIO)),
     )
     height = max(
         GRID_MIN_ROW_UNITS,
-        int(round(((size_y / GRID_RATIO) * 100) / ROW_HEIGHT))
+        int(round(((size_y / GRID_RATIO) * 100) / ROW_HEIGHT)),
     )
     if code is not None:
         markdown_content = ' '  # white-space markdown
@@ -210,7 +213,7 @@ def get_chart_holder(position):
                 'width': width,
                 'height': height,
                 'code': markdown_content,
-            }
+            },
         }
 
     return {
@@ -233,7 +236,7 @@ def get_children_sum(children, attr, root):
     return reduce(
         (lambda sum, childId: sum + root[childId]['meta'][attr]),
         children,
-        0
+        0,
     )
 
 
@@ -243,8 +246,8 @@ def get_wide_column_ids(children, root):
     return list(
         filter(
             lambda childId: can_reduce_column_width(root[childId], root),
-            children
-        )
+            children,
+        ),
     )
 
 
@@ -274,8 +277,8 @@ def reduce_row_width(row_component, root):
     wide_leaf_component_ids = list(
         filter(
             lambda childId: is_wide_leaf_component(root[childId]),
-            row_component['children']
-        )
+            row_component['children'],
+        ),
     )
 
     widest_chart_id = None
@@ -480,7 +483,7 @@ def convert_to_layout(positions):
                             for childId in root[current_column]['children']:
                                 if root[childId]['type'] == ROW_TYPE:
                                     root[childId]['meta']['width'] = reduce_row_width(
-                                        root[childId], root
+                                        root[childId], root,
                                     )
                                 else:
                                     root[childId]['meta']['width'] = \
@@ -489,12 +492,12 @@ def convert_to_layout(positions):
                             root[current_column]['meta']['width'] = get_children_max(
                                 root[current_column]['children'],
                                 'width',
-                                root
+                                root,
                             )
                             current_width = get_children_sum(
                                 item['children'],
                                 'width',
-                                root
+                                root,
                             )
                             idx += 1
 
@@ -574,7 +577,7 @@ def scan_dashboard_positions_data(positions):
                     idx = sorted(
                         available_columns_index,
                         key=lambda x: next_row[x]['size_x'],
-                        reverse=True
+                        reverse=True,
                     )[0]
 
                 next_position = next_row.pop(idx)
@@ -646,10 +649,10 @@ def upgrade():
                 positions.append(position)
 
             v2_layout = convert_to_layout(positions)
-            v2_layout[DASHBOARD_HEADER_ID] = get_header_component(dashboard.dashboard_title)
+            v2_layout[DASHBOARD_HEADER_ID] = get_header_component(
+                dashboard.dashboard_title)
 
             sorted_by_key = collections.OrderedDict(sorted(v2_layout.items()))
-            # print('converted position_json:\n {}'.format(json.dumps(sorted_by_key, indent=2)))
             dashboard.position_json = json.dumps(sorted_by_key, indent=2)
             session.merge(dashboard)
             session.commit()
diff --git a/superset/migrations/versions/bf706ae5eb46_cal_heatmap_metric_to_metrics.py b/superset/migrations/versions/bf706ae5eb46_cal_heatmap_metric_to_metrics.py
index 3504280..e1c6b3f 100644
--- a/superset/migrations/versions/bf706ae5eb46_cal_heatmap_metric_to_metrics.py
+++ b/superset/migrations/versions/bf706ae5eb46_cal_heatmap_metric_to_metrics.py
@@ -5,14 +5,18 @@ Revises: f231d82b9b26
 Create Date: 2018-04-10 11:19:47.621878
 
 """
-from alembic import op
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 import json
-from sqlalchemy.ext.declarative import declarative_base
+
+from alembic import op
 from sqlalchemy import Column, Integer, String, Text
+from sqlalchemy.ext.declarative import declarative_base
 
 from superset import db
-from superset.legacy import cast_form_data
 
 Base = declarative_base()
 
diff --git a/superset/migrations/versions/c18bd4186f15_.py b/superset/migrations/versions/c18bd4186f15_.py
index cecb6f5..9706c2b 100644
--- a/superset/migrations/versions/c18bd4186f15_.py
+++ b/superset/migrations/versions/c18bd4186f15_.py
@@ -10,9 +10,6 @@ Create Date: 2018-07-24 14:29:41.341098
 revision = 'c18bd4186f15'
 down_revision = ('46ba6aaaac97', 'ec1f88a35cc6')
 
-from alembic import op
-import sqlalchemy as sa
-
 
 def upgrade():
     pass
diff --git a/superset/migrations/versions/c3a8f8611885_materializing_permission.py b/superset/migrations/versions/c3a8f8611885_materializing_permission.py
index f4c65a8..b0ac94c 100644
--- a/superset/migrations/versions/c3a8f8611885_materializing_permission.py
+++ b/superset/migrations/versions/c3a8f8611885_materializing_permission.py
@@ -6,20 +6,26 @@ Revises: 4fa88fe24e94
 Create Date: 2016-04-25 08:54:04.303859
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
+from alembic import op
+import sqlalchemy as sa
+from sqlalchemy import Column, ForeignKey, Integer, String
+from sqlalchemy.ext.declarative import declarative_base
+
+from superset import db
 
 # revision identifiers, used by Alembic.
 revision = 'c3a8f8611885'
 down_revision = '4fa88fe24e94'
 
-from alembic import op
-import sqlalchemy as sa
-from superset import db
-from sqlalchemy.ext.declarative import declarative_base
-from sqlalchemy import (
-    Column, Integer, String, ForeignKey)
 
 Base = declarative_base()
 
+
 class Slice(Base):
     """Declarative class to do query in upgrade"""
     __tablename__ = 'slices'
@@ -29,6 +35,7 @@ class Slice(Base):
     table_id = Column(Integer, ForeignKey('tables.id'))
     perm = Column(String(2000))
 
+
 def upgrade():
     bind = op.get_bind()
     op.add_column('slices', sa.Column('perm', sa.String(length=2000), nullable=True))
diff --git a/superset/migrations/versions/c9495751e314_.py b/superset/migrations/versions/c9495751e314_.py
index 53381e7..52a57aa 100644
--- a/superset/migrations/versions/c9495751e314_.py
+++ b/superset/migrations/versions/c9495751e314_.py
@@ -5,6 +5,10 @@ Revises: ('30bb17c0dc76', 'bf706ae5eb46')
 Create Date: 2018-04-10 20:46:57.890773
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = 'c9495751e314'
diff --git a/superset/migrations/versions/d6db5a5cdb5d_.py b/superset/migrations/versions/d6db5a5cdb5d_.py
index 0bb75ec..d5b996e 100644
--- a/superset/migrations/versions/d6db5a5cdb5d_.py
+++ b/superset/migrations/versions/d6db5a5cdb5d_.py
@@ -6,6 +6,10 @@ Revises: ('a99f2f7c195a', 'bcf3126872fc')
 Create Date: 2017-02-10 17:58:20.149960
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = 'd6db5a5cdb5d'
diff --git a/superset/migrations/versions/e46f2d27a08e_materialize_perms.py b/superset/migrations/versions/e46f2d27a08e_materialize_perms.py
index 6b13a2d..80f7961 100644
--- a/superset/migrations/versions/e46f2d27a08e_materialize_perms.py
+++ b/superset/migrations/versions/e46f2d27a08e_materialize_perms.py
@@ -6,6 +6,10 @@ Revises: c611f2b591b8
 Create Date: 2016-11-14 15:23:32.594898
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = 'e46f2d27a08e'
diff --git a/superset/migrations/versions/ec1f88a35cc6_.py b/superset/migrations/versions/ec1f88a35cc6_.py
index e84c621..ed1b282 100644
--- a/superset/migrations/versions/ec1f88a35cc6_.py
+++ b/superset/migrations/versions/ec1f88a35cc6_.py
@@ -10,9 +10,6 @@ Create Date: 2018-07-23 11:18:11.866106
 revision = 'ec1f88a35cc6'
 down_revision = ('bebcf3fed1fe', '705732c70154')
 
-from alembic import op
-import sqlalchemy as sa
-
 
 def upgrade():
     pass
diff --git a/superset/migrations/versions/ef8843b41dac_.py b/superset/migrations/versions/ef8843b41dac_.py
index cf7d587..6c309e2 100644
--- a/superset/migrations/versions/ef8843b41dac_.py
+++ b/superset/migrations/versions/ef8843b41dac_.py
@@ -6,14 +6,15 @@ Revises: ('3b626e2a6783', 'ab3d66c4246e')
 Create Date: 2016-10-02 10:35:38.825231
 
 """
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
 
 # revision identifiers, used by Alembic.
 revision = 'ef8843b41dac'
 down_revision = ('3b626e2a6783', 'ab3d66c4246e')
 
-from alembic import op
-import sqlalchemy as sa
-
 
 def upgrade():
     pass


Mime
View raw message