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: [flake8] Resolve I??? errors (#3797)
Date Wed, 08 Nov 2017 04:23:43 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 e2bca47  [flake8] Resolve I??? errors (#3797)
e2bca47 is described below

commit e2bca4742177f50237cd8c24aa353f31343f7fb8
Author: John Bodley <4567245+john-bodley@users.noreply.github.com>
AuthorDate: Tue Nov 7 20:23:40 2017 -0800

    [flake8] Resolve I??? errors (#3797)
---
 scripts/permissions_cleanup.py      |  3 ++-
 setup.py                            |  5 +++--
 superset/__init__.py                |  5 ++---
 superset/cache_util.py              |  3 ++-
 superset/cli.py                     |  2 +-
 superset/config.py                  |  2 +-
 superset/connectors/base/models.py  |  4 ++--
 superset/connectors/base/views.py   |  5 +++--
 superset/connectors/druid/models.py | 44 +++++++++++++++++--------------------
 superset/connectors/druid/views.py  | 17 +++++++-------
 superset/connectors/sqla/models.py  | 33 +++++++++++++---------------
 superset/connectors/sqla/views.py   | 17 ++++++--------
 superset/data/__init__.py           |  9 ++++----
 superset/dataframe.py               |  7 +++---
 superset/db_engine_specs.py         | 15 +++++--------
 superset/extract_table_names.py     |  4 ++--
 superset/import_util.py             |  1 +
 superset/jinja_context.py           |  5 ++---
 superset/legacy.py                  |  1 +
 superset/models/annotations.py      |  5 ++---
 superset/models/core.py             | 33 ++++++++++++----------------
 superset/models/helpers.py          | 12 +++++-----
 superset/models/sql_lab.py          | 15 +++++--------
 superset/security.py                |  3 ++-
 superset/sql_lab.py                 | 16 +++++++-------
 superset/sql_parse.py               |  2 +-
 superset/stats_logger.py            |  1 +
 superset/utils.py                   | 34 ++++++++++++++--------------
 superset/views/annotations.py       |  6 ++---
 superset/views/base.py              | 16 ++++++--------
 superset/views/core.py              | 28 ++++++++++-------------
 superset/views/sql_lab.py           |  6 ++---
 superset/viz.py                     | 17 +++++++-------
 tests/access_tests.py               |  9 ++++----
 tests/base_tests.py                 |  8 +++----
 tests/celery_tests.py               |  6 ++---
 tests/core_tests.py                 |  7 +++---
 tests/druid_tests.py                |  7 +++---
 tests/email_tests.py                | 10 ++++-----
 tests/import_export_tests.py        | 12 +++++-----
 tests/security_tests.py             |  1 -
 tests/sqllab_tests.py               |  4 ++--
 tests/utils_tests.py                | 20 +++++------------
 tests/viz_tests.py                  |  9 ++++----
 tox.ini                             |  4 ----
 45 files changed, 214 insertions(+), 259 deletions(-)

diff --git a/scripts/permissions_cleanup.py b/scripts/permissions_cleanup.py
index 87c8fad..8d57a01 100644
--- a/scripts/permissions_cleanup.py
+++ b/scripts/permissions_cleanup.py
@@ -1,6 +1,7 @@
-from superset import sm
 from collections import defaultdict
 
+from superset import sm
+
 
 def cleanup_permissions():
     # 1. Clean up duplicates.
diff --git a/setup.py b/setup.py
index 53c5dc4..3ea155d 100644
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,8 @@
+import json
 import os
 import subprocess
-import json
-from setuptools import setup, find_packages
+
+from setuptools import find_packages, setup
 
 BASE_DIR = os.path.abspath(os.path.dirname(__file__))
 PACKAGE_DIR = os.path.join(BASE_DIR, 'superset', 'static', 'assets')
diff --git a/superset/__init__.py b/superset/__init__.py
index 1e56303..6c1c906 100644
--- a/superset/__init__.py
+++ b/superset/__init__.py
@@ -4,14 +4,13 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
+import json
 import logging
 from logging.handlers import TimedRotatingFileHandler
-
-import json
 import os
 
 from flask import Flask, redirect
-from flask_appbuilder import SQLA, AppBuilder, IndexView
+from flask_appbuilder import AppBuilder, IndexView, SQLA
 from flask_appbuilder.baseviews import expose
 from flask_migrate import Migrate
 from flask_wtf.csrf import CSRFProtect
diff --git a/superset/cache_util.py b/superset/cache_util.py
index ecba03f..9612324 100644
--- a/superset/cache_util.py
+++ b/superset/cache_util.py
@@ -1,6 +1,7 @@
-from superset import tables_cache
 from flask import request
 
+from superset import tables_cache
+
 
 def view_cache_key(*unused_args, **unused_kwargs):
     args_hash = hash(frozenset(request.args.items()))
diff --git a/superset/cli.py b/superset/cli.py
index 0c666e1..dbf7b9f 100755
--- a/superset/cli.py
+++ b/superset/cli.py
@@ -4,8 +4,8 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-import logging
 from datetime import datetime
+import logging
 from subprocess import Popen
 
 from colorama import Fore, Style
diff --git a/superset/config.py b/superset/config.py
index 4a12bff..c78595c 100644
--- a/superset/config.py
+++ b/superset/config.py
@@ -9,11 +9,11 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
+from collections import OrderedDict
 import imp
 import json
 import os
 import sys
-from collections import OrderedDict
 
 from dateutil import tz
 from flask_appbuilder.security.manager import AUTH_DB
diff --git a/superset/connectors/base/models.py b/superset/connectors/base/models.py
index 4f3dab0..406dbd0 100644
--- a/superset/connectors/base/models.py
+++ b/superset/connectors/base/models.py
@@ -1,10 +1,10 @@
 import json
 
 from sqlalchemy import (
-    and_, Column, Integer, String, Text, Boolean,
+    and_, Boolean, Column, Integer, String, Text,
 )
-from sqlalchemy.orm import foreign, relationship
 from sqlalchemy.ext.declarative import declared_attr
+from sqlalchemy.orm import foreign, relationship
 
 from superset import utils
 from superset.models.core import Slice
diff --git a/superset/connectors/base/views.py b/superset/connectors/base/views.py
index 36cfe45..97a40eb 100644
--- a/superset/connectors/base/views.py
+++ b/superset/connectors/base/views.py
@@ -1,7 +1,8 @@
-from superset.views.base import SupersetModelView
-from superset.utils import SupersetException
 from flask import Markup
 
+from superset.utils import SupersetException
+from superset.views.base import SupersetModelView
+
 
 class DatasourceModelView(SupersetModelView):
     def pre_delete(self, obj):
diff --git a/superset/connectors/druid/models.py b/superset/connectors/druid/models.py
index 28c5e7c..1f724e7 100644
--- a/superset/connectors/druid/models.py
+++ b/superset/connectors/druid/models.py
@@ -1,41 +1,37 @@
  # pylint: disable=invalid-unary-operand-type
 from collections import OrderedDict
-import json
-import logging
 from copy import deepcopy
 from datetime import datetime, timedelta
-from six import string_types
+import json
+import logging
 from multiprocessing import Pool
 
-import requests
-import sqlalchemy as sa
-from sqlalchemy import (
-    Column, Integer, String, ForeignKey, Text, Boolean,
-    DateTime, or_,
-)
-from sqlalchemy.orm import backref, relationship
 from dateutil.parser import parse as dparse
-
+from flask import escape, Markup
+from flask_appbuilder import Model
+from flask_appbuilder.models.decorators import renders
+from flask_babel import lazy_gettext as _
 from pydruid.client import PyDruid
 from pydruid.utils.aggregators import count
-from pydruid.utils.filters import Dimension, Filter, Bound
+from pydruid.utils.filters import Bound, Dimension, Filter
+from pydruid.utils.having import Aggregation
 from pydruid.utils.postaggregator import (
-    Postaggregator, Quantile, Quantiles, Field, Const, HyperUniqueCardinality,
+    Const, Field, HyperUniqueCardinality, Postaggregator, Quantile, Quantiles,
 )
-from pydruid.utils.having import Aggregation
-
-from flask import Markup, escape
-from flask_appbuilder.models.decorators import renders
-from flask_appbuilder import Model
-
-from flask_babel import lazy_gettext as _
+import requests
+from six import string_types
+import sqlalchemy as sa
+from sqlalchemy import (
+    Boolean, Column, DateTime, ForeignKey, Integer, or_, String, Text,
+)
+from sqlalchemy.orm import backref, relationship
 
-from superset import conf, db, import_util, utils, sm
+from superset import conf, db, import_util, sm, utils
+from superset.connectors.base.models import BaseColumn, BaseDatasource, BaseMetric
+from superset.models.helpers import AuditMixinNullable, QueryResult, set_perm
 from superset.utils import (
-    flasher, MetricPermException, DimSelector, DTTM_ALIAS
+    DimSelector, DTTM_ALIAS, flasher, MetricPermException,
 )
-from superset.connectors.base.models import BaseDatasource, BaseColumn, BaseMetric
-from superset.models.helpers import AuditMixinNullable, QueryResult, set_perm
 
 DRUID_TZ = conf.get("DRUID_TZ")
 
diff --git a/superset/connectors/druid/views.py b/superset/connectors/druid/views.py
index 9206025..d3e0fa5 100644
--- a/superset/connectors/druid/views.py
+++ b/superset/connectors/druid/views.py
@@ -1,22 +1,21 @@
 from datetime import datetime
 import logging
 
-from flask import Markup, flash, redirect
+from flask import flash, Markup, redirect
 from flask_appbuilder import CompactCRUDMixin, expose
 from flask_appbuilder.models.sqla.interface import SQLAInterface
-
-from flask_babel import lazy_gettext as _
 from flask_babel import gettext as __
+from flask_babel import lazy_gettext as _
 
-from superset import db, utils, appbuilder, sm, security
+from superset import appbuilder, db, security, sm, utils
+from superset.connectors.base.views import DatasourceModelView
 from superset.connectors.connector_registry import ConnectorRegistry
 from superset.utils import has_access
-from superset.connectors.base.views import DatasourceModelView
 from superset.views.base import (
-    BaseSupersetView,
-    SupersetModelView, validate_json, DeleteMixin, ListWidgetWithCheckboxes,
-    DatasourceFilter, get_datasource_exist_error_mgs)
-
+    BaseSupersetView, DatasourceFilter, DeleteMixin,
+    get_datasource_exist_error_mgs, ListWidgetWithCheckboxes, SupersetModelView,
+    validate_json
+)
 from . import models
 
 
diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 17c3fd5..975cce9 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -1,31 +1,28 @@
 from datetime import datetime
 import logging
-import sqlparse
-from past.builtins import basestring
 
+from flask import escape, Markup
+from flask_appbuilder import Model
+from flask_babel import lazy_gettext as _
 import pandas as pd
-
+from past.builtins import basestring
+import sqlalchemy as sa
 from sqlalchemy import (
-    Column, Integer, String, ForeignKey, Text, Boolean,
-    DateTime,
+    and_, asc, Boolean, Column, DateTime, desc, ForeignKey, Integer, or_,
+    select, String, Text,
 )
-import sqlalchemy as sa
-from sqlalchemy import asc, and_, desc, select, or_
-from sqlalchemy.sql.expression import TextAsFrom
 from sqlalchemy.orm import backref, relationship
-from sqlalchemy.sql import table, literal_column, text, column
-
-from flask import escape, Markup
-from flask_appbuilder import Model
-from flask_babel import lazy_gettext as _
+from sqlalchemy.sql import column, literal_column, table, text
+from sqlalchemy.sql.expression import TextAsFrom
+import sqlparse
 
-from superset import db, utils, import_util, sm
-from superset.connectors.base.models import BaseDatasource, BaseColumn, BaseMetric
-from superset.utils import DTTM_ALIAS, QueryStatus
-from superset.models.helpers import QueryResult
-from superset.models.core import Database
+from superset import db, import_util, sm, utils
+from superset.connectors.base.models import BaseColumn, BaseDatasource, BaseMetric
 from superset.jinja_context import get_template_processor
+from superset.models.core import Database
+from superset.models.helpers import QueryResult
 from superset.models.helpers import set_perm
+from superset.utils import DTTM_ALIAS, QueryStatus
 
 
 class TableColumn(Model, BaseColumn):
diff --git a/superset/connectors/sqla/views.py b/superset/connectors/sqla/views.py
index e8fdf8d..495c98d 100644
--- a/superset/connectors/sqla/views.py
+++ b/superset/connectors/sqla/views.py
@@ -1,22 +1,19 @@
 """Views used by the SqlAlchemy connector"""
-from past.builtins import basestring
-
-from flask import Markup, flash, redirect
+from flask import flash, Markup, redirect
 from flask_appbuilder import CompactCRUDMixin, expose
 from flask_appbuilder.actions import action
 from flask_appbuilder.models.sqla.interface import SQLAInterface
-
-from flask_babel import lazy_gettext as _
 from flask_babel import gettext as __
+from flask_babel import lazy_gettext as _
+from past.builtins import basestring
 
-from superset import appbuilder, db, utils, security, sm
-from superset.utils import has_access
+from superset import appbuilder, db, security, sm, utils
 from superset.connectors.base.views import DatasourceModelView
+from superset.utils import has_access
 from superset.views.base import (
-    SupersetModelView, ListWidgetWithCheckboxes, DeleteMixin, DatasourceFilter,
-    get_datasource_exist_error_mgs,
+    DatasourceFilter, DeleteMixin, get_datasource_exist_error_mgs,
+    ListWidgetWithCheckboxes, SupersetModelView,
 )
-
 from . import models
 
 
diff --git a/superset/data/__init__.py b/superset/data/__init__.py
index 3915106..3b5689e 100644
--- a/superset/data/__init__.py
+++ b/superset/data/__init__.py
@@ -4,22 +4,21 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
+import datetime
 import gzip
 import json
 import os
-import textwrap
-import datetime
 import random
+import textwrap
 
 import pandas as pd
-from sqlalchemy import String, DateTime, Date, Float, BigInteger
+from sqlalchemy import BigInteger, Date, DateTime, Float, String
 
 from superset import app, db, utils
+from superset.connectors.connector_registry import ConnectorRegistry
 from superset.models import core as models
 from superset.security import get_or_create_main_db
 
-from superset.connectors.connector_registry import ConnectorRegistry
-
 # Shortcuts
 DB = models.Database
 Slice = models.Slice
diff --git a/superset/dataframe.py b/superset/dataframe.py
index 66034bb..1e56f2b 100644
--- a/superset/dataframe.py
+++ b/superset/dataframe.py
@@ -10,13 +10,12 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-from datetime import datetime, date
-from past.builtins import basestring
+from datetime import date, datetime
 
+import numpy as np
 import pandas as pd
 from pandas.core.dtypes.dtypes import ExtensionDtype
-
-import numpy as np
+from past.builtins import basestring
 
 
 INFER_COL_TYPES_THRESHOLD = 95
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index d37096a..c287a7e 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -16,24 +16,21 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-from collections import namedtuple, defaultdict
-
+from collections import defaultdict, namedtuple
 import inspect
 import logging
 import re
 import textwrap
 import time
 
-import sqlparse
-from sqlalchemy import select
-from sqlalchemy.sql import text
 from flask_babel import lazy_gettext as _
-
+from sqlalchemy import select
 from sqlalchemy.engine.url import make_url
+from sqlalchemy.sql import text
+import sqlparse
 
-from superset.utils import SupersetTemplateException
-from superset.utils import QueryStatus
-from superset import conf, cache_util, utils
+from superset import cache_util, conf, utils
+from superset.utils import QueryStatus, SupersetTemplateException
 
 tracking_url_trans = conf.get('TRACKING_URL_TRANSFORMER')
 
diff --git a/superset/extract_table_names.py b/superset/extract_table_names.py
index 4bc5707..a86b067 100644
--- a/superset/extract_table_names.py
+++ b/superset/extract_table_names.py
@@ -13,8 +13,8 @@
 # http://groups.google.com/group/sqlparse/browse_thread/thread/b0bd9a022e9d4895
 
 import sqlparse
-from sqlparse.sql import IdentifierList, Identifier
-from sqlparse.tokens import Keyword, DML
+from sqlparse.sql import Identifier, IdentifierList
+from sqlparse.tokens import DML, Keyword
 
 
 def is_subselect(parsed):
diff --git a/superset/import_util.py b/superset/import_util.py
index 8795b5a..47ffc4d 100644
--- a/superset/import_util.py
+++ b/superset/import_util.py
@@ -1,4 +1,5 @@
 import logging
+
 from sqlalchemy.orm.session import make_transient
 
 
diff --git a/superset/jinja_context.py b/superset/jinja_context.py
index a019ed3..dad3e9a 100644
--- a/superset/jinja_context.py
+++ b/superset/jinja_context.py
@@ -10,10 +10,9 @@ import random
 import time
 import uuid
 
-from jinja2.sandbox import SandboxedEnvironment
-from flask import request, g
-
 from dateutil.relativedelta import relativedelta
+from flask import g, request
+from jinja2.sandbox import SandboxedEnvironment
 
 from superset import app
 
diff --git a/superset/legacy.py b/superset/legacy.py
index c398d87..7585c75 100644
--- a/superset/legacy.py
+++ b/superset/legacy.py
@@ -5,6 +5,7 @@ from __future__ import print_function
 from __future__ import unicode_literals
 
 import re
+
 from superset import frontend_config
 
 FORM_DATA_KEY_WHITELIST = list(frontend_config.get('controls').keys()) + ['slice_id']
diff --git a/superset/models/annotations.py b/superset/models/annotations.py
index 13a1df2..8aac6a2 100644
--- a/superset/models/annotations.py
+++ b/superset/models/annotations.py
@@ -4,12 +4,11 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
+from flask_appbuilder import Model
 from sqlalchemy import (
-    Column, Integer, String, ForeignKey, Text,
-    DateTime, Index,
+    Column, DateTime, ForeignKey, Index, Integer, String, Text,
 )
 from sqlalchemy.orm import relationship
-from flask_appbuilder import Model
 
 from superset.models.helpers import AuditMixinNullable
 
diff --git a/superset/models/core.py b/superset/models/core.py
index 78a72a7..2db2af6 100644
--- a/superset/models/core.py
+++ b/superset/models/core.py
@@ -4,43 +4,38 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
+from copy import copy, deepcopy
+from datetime import date, datetime
 import functools
 import json
 import logging
-import numpy
 import pickle
 import textwrap
-from future.standard_library import install_aliases
-from copy import copy
-from datetime import datetime, date
-from copy import deepcopy
-
-import pandas as pd
-import sqlalchemy as sqla
-from sqlalchemy.engine.url import make_url
-from sqlalchemy.orm import subqueryload
 
 from flask import escape, g, Markup, request
 from flask_appbuilder import Model
 from flask_appbuilder.models.decorators import renders
-
+from future.standard_library import install_aliases
+import numpy
+import pandas as pd
+import sqlalchemy as sqla
 from sqlalchemy import (
-    Column, Integer, String, ForeignKey, Text, Boolean,
-    DateTime, Date, Table,
-    create_engine, MetaData, select
+    Boolean, Column, create_engine, Date, DateTime, ForeignKey, Integer,
+    MetaData, select, String, Table, Text,
 )
-from sqlalchemy.orm import relationship
+from sqlalchemy.engine import url
+from sqlalchemy.engine.url import make_url
+from sqlalchemy.orm import relationship, subqueryload
 from sqlalchemy.orm.session import make_transient
 from sqlalchemy.pool import NullPool
 from sqlalchemy.sql import text
 from sqlalchemy.sql.expression import TextAsFrom
-from sqlalchemy.engine import url
 from sqlalchemy_utils import EncryptedType
 
-from superset import app, db, db_engine_specs, utils, sm
+from superset import app, db, db_engine_specs, sm, utils
 from superset.connectors.connector_registry import ConnectorRegistry
-from superset.viz import viz_types
 from superset.models.helpers import AuditMixinNullable, ImportMixin, set_perm
+from superset.viz import viz_types
 install_aliases()
 from urllib import parse  # noqa
 
@@ -648,7 +643,7 @@ class Database(Model, AuditMixinNullable):
                                                                     effective_username))
         if configuration:
             params["connect_args"] = {"configuration": configuration}
-        
+
         return create_engine(url, **params)
 
     def get_reserved_words(self):
diff --git a/superset/models/helpers.py b/superset/models/helpers.py
index 228c54e..9299760 100644
--- a/superset/models/helpers.py
+++ b/superset/models/helpers.py
@@ -5,18 +5,18 @@ from __future__ import print_function
 from __future__ import unicode_literals
 
 from datetime import datetime
-import humanize
 import json
 import re
-import sqlalchemy as sa
-
-from sqlalchemy.ext.declarative import declared_attr
 
 from flask import escape, Markup
-from flask_appbuilder.models.mixins import AuditMixin
 from flask_appbuilder.models.decorators import renders
-from superset.utils import QueryStatus
+from flask_appbuilder.models.mixins import AuditMixin
+import humanize
+import sqlalchemy as sa
+from sqlalchemy.ext.declarative import declared_attr
+
 from superset import sm
+from superset.utils import QueryStatus
 
 
 class ImportMixin(object):
diff --git a/superset/models/sql_lab.py b/superset/models/sql_lab.py
index 24aff21..b4fc8cc 100644
--- a/superset/models/sql_lab.py
+++ b/superset/models/sql_lab.py
@@ -4,24 +4,21 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-import re
 from datetime import datetime
-
-from future.standard_library import install_aliases
+import re
 
 from flask import Markup
-
 from flask_appbuilder import Model
-
+from future.standard_library import install_aliases
 import sqlalchemy as sqla
 from sqlalchemy import (
-    Column, Integer, String, ForeignKey, Text, Boolean,
-    DateTime, Numeric, )
+    Boolean, Column, DateTime, ForeignKey, Integer, Numeric, String, Text,
+)
 from sqlalchemy.orm import backref, relationship
 
 from superset import sm
-from superset.utils import QueryStatus
 from superset.models.helpers import AuditMixinNullable
+from superset.utils import QueryStatus
 
 install_aliases()
 
@@ -81,7 +78,7 @@ class Query(Model):
     user = relationship(sm.user_model, foreign_keys=[user_id])
 
     __table_args__ = (
-        sqla.Index('ti_user_id_changed_on', user_id, changed_on), 
+        sqla.Index('ti_user_id_changed_on', user_id, changed_on),
     )
 
     @property
diff --git a/superset/security.py b/superset/security.py
index 11b6b64..1175985 100644
--- a/superset/security.py
+++ b/superset/security.py
@@ -5,11 +5,12 @@ from __future__ import print_function
 from __future__ import unicode_literals
 
 import logging
+
 from flask_appbuilder.security.sqla import models as ab_models
 
 from superset import conf, db, sm
-from superset.models import core as models
 from superset.connectors.connector_registry import ConnectorRegistry
+from superset.models import core as models
 
 READ_ONLY_MODEL_VIEWS = {
     'DatabaseAsync',
diff --git a/superset/sql_lab.py b/superset/sql_lab.py
index 7bfba5b..50bcc1b 100644
--- a/superset/sql_lab.py
+++ b/superset/sql_lab.py
@@ -3,24 +3,24 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-from time import sleep
 from datetime import datetime
 import json
 import logging
+from time import sleep
 import uuid
+
+from celery.exceptions import SoftTimeLimitExceeded
 import pandas as pd
 import sqlalchemy
-
-from sqlalchemy.pool import NullPool
 from sqlalchemy.orm import sessionmaker
-from celery.exceptions import SoftTimeLimitExceeded
+from sqlalchemy.pool import NullPool
 
-from superset import (app, db, utils, dataframe, results_backend)
-from superset.models.sql_lab import Query
-from superset.sql_parse import SupersetQuery
+from superset import app, dataframe, db, results_backend, utils
 from superset.db_engine_specs import LimitMethod
 from superset.jinja_context import get_template_processor
-from superset.utils import QueryStatus, get_celery_app
+from superset.models.sql_lab import Query
+from superset.sql_parse import SupersetQuery
+from superset.utils import get_celery_app, QueryStatus
 
 config = app.config
 celery_app = get_celery_app(config)
diff --git a/superset/sql_parse.py b/superset/sql_parse.py
index bcf36bf..7fc31c0 100644
--- a/superset/sql_parse.py
+++ b/superset/sql_parse.py
@@ -6,7 +6,7 @@ from __future__ import unicode_literals
 import logging
 
 import sqlparse
-from sqlparse.sql import IdentifierList, Identifier
+from sqlparse.sql import Identifier, IdentifierList
 from sqlparse.tokens import Keyword, Name
 
 RESULT_OPERATIONS = {'UNION', 'INTERSECT', 'EXCEPT'}
diff --git a/superset/stats_logger.py b/superset/stats_logger.py
index 6146e32..470f2e2 100644
--- a/superset/stats_logger.py
+++ b/superset/stats_logger.py
@@ -1,4 +1,5 @@
 import logging
+
 from colorama import Fore, Style
 
 
diff --git a/superset/utils.py b/superset/utils.py
index fa72971..569147b 100644
--- a/superset/utils.py
+++ b/superset/utils.py
@@ -4,45 +4,43 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
+from builtins import object
+from datetime import date, datetime, time, timedelta
 import decimal
+from email.mime.application import MIMEApplication
+from email.mime.multipart import MIMEMultipart
+from email.mime.text import MIMEText
+from email.utils import formatdate
 import functools
 import json
 import logging
 import os
 import signal
-import parsedatetime
 import smtplib
-import pytz
-import sqlalchemy as sa
-import uuid
 import sys
+import uuid
 import zlib
-import numpy
-
-from builtins import object
-from datetime import date, datetime, time, timedelta
 
 import celery
 from dateutil.parser import parse
-from email.mime.text import MIMEText
-from email.mime.multipart import MIMEMultipart
-from email.mime.application import MIMEApplication
-from email.utils import formatdate
-
-from flask import flash, Markup, render_template, url_for, redirect, request
+from flask import flash, Markup, redirect, render_template, request, url_for
+from flask_appbuilder._compat import as_unicode
 from flask_appbuilder.const import (
-    LOGMSG_ERR_SEC_ACCESS_DENIED,
     FLAMSG_ERR_SEC_ACCESS_DENIED,
-    PERMISSION_PREFIX
+    LOGMSG_ERR_SEC_ACCESS_DENIED,
+    PERMISSION_PREFIX,
 )
-from flask_appbuilder._compat import as_unicode
 from flask_babel import gettext as __
 from flask_cache import Cache
 import markdown as md
+import numpy
+import parsedatetime
 from past.builtins import basestring
 from pydruid.utils.having import Having
+import pytz
+import sqlalchemy as sa
 from sqlalchemy import event, exc, select
-from sqlalchemy.types import TypeDecorator, TEXT
+from sqlalchemy.types import TEXT, TypeDecorator
 
 logging.getLogger('MARKDOWN').setLevel(logging.INFO)
 
diff --git a/superset/views/annotations.py b/superset/views/annotations.py
index 4db11d1..b43e97e 100644
--- a/superset/views/annotations.py
+++ b/superset/views/annotations.py
@@ -3,12 +3,12 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-from flask_babel import gettext as __
 from flask_appbuilder.models.sqla.interface import SQLAInterface
+from flask_babel import gettext as __
 
-from superset.models.annotations import Annotation, AnnotationLayer
 from superset import appbuilder
-from .base import SupersetModelView, DeleteMixin
+from superset.models.annotations import Annotation, AnnotationLayer
+from .base import DeleteMixin, SupersetModelView
 
 
 class AnnotationModelView(SupersetModelView, DeleteMixin):  # noqa
diff --git a/superset/views/base.py b/superset/views/base.py
index bc8d46e..cba4591 100644
--- a/superset/views/base.py
+++ b/superset/views/base.py
@@ -3,18 +3,16 @@ import json
 import logging
 import traceback
 
-from flask import g, redirect, Response, flash, abort, get_flashed_messages
-from flask_babel import gettext as __
-from flask_babel import lazy_gettext as _
-from flask_babel import get_locale
-
-from flask_appbuilder import BaseView
-from flask_appbuilder import ModelView
-from flask_appbuilder.widgets import ListWidget
+from flask import abort, flash, g, get_flashed_messages, redirect, Response
+from flask_appbuilder import BaseView, ModelView
 from flask_appbuilder.actions import action
 from flask_appbuilder.models.sqla.filters import BaseFilter
+from flask_appbuilder.widgets import ListWidget
+from flask_babel import get_locale
+from flask_babel import gettext as __
+from flask_babel import lazy_gettext as _
 
-from superset import appbuilder, conf, db, utils, sm, sql_parse
+from superset import appbuilder, conf, db, sm, sql_parse, utils
 from superset.connectors.connector_registry import ConnectorRegistry
 from superset.connectors.sqla.models import SqlaTable
 from superset.translations.utils import get_language_pack
diff --git a/superset/views/core.py b/superset/views/core.py
index 7c60f86..1c56f00 100755
--- a/superset/views/core.py
+++ b/superset/views/core.py
@@ -7,46 +7,42 @@ from collections import defaultdict
 from datetime import datetime, timedelta
 import json
 import logging
-import pandas as pd
 import pickle
 import re
 import time
 import traceback
 from urllib import parse
 
-import sqlalchemy as sqla
-
 from flask import (
-    g, request, redirect, flash, Response, render_template, Markup,
-    url_for)
+    flash, g, Markup, redirect, render_template, request, Response, url_for,
+)
 from flask_appbuilder import expose
 from flask_appbuilder.actions import action
 from flask_appbuilder.models.sqla.interface import SQLAInterface
 from flask_appbuilder.security.decorators import has_access_api
 from flask_appbuilder.security.sqla import models as ab_models
-
 from flask_babel import gettext as __
 from flask_babel import lazy_gettext as _
-
+import pandas as pd
+import sqlalchemy as sqla
 from sqlalchemy import create_engine
 from sqlalchemy.engine.url import make_url
 from werkzeug.routing import BaseConverter
 
 from superset import (
-    appbuilder, cache, db, viz, utils, app,
-    sm, sql_lab, results_backend, security,
+    app, appbuilder, cache, db, results_backend, security, sm, sql_lab, utils,
+    viz,
 )
-from superset.legacy import cast_form_data
-from superset.utils import has_access, QueryStatus, merge_extra_filters
 from superset.connectors.connector_registry import ConnectorRegistry
+from superset.legacy import cast_form_data
 import superset.models.core as models
 from superset.models.sql_lab import Query
 from superset.sql_parse import SupersetQuery
-
+from superset.utils import has_access, merge_extra_filters, QueryStatus
 from .base import (
-    api, SupersetModelView, BaseSupersetView, DeleteMixin,
-    SupersetFilter, get_user_roles, json_error_response, get_error_msg,
-    CsvResponse)
+    api, BaseSupersetView, CsvResponse, DeleteMixin, get_error_msg,
+    get_user_roles, json_error_response, SupersetFilter, SupersetModelView,
+)
 
 config = app.config
 stats_logger = config.get('STATS_LOGGER')
@@ -1452,7 +1448,7 @@ class Superset(BaseSupersetView):
                 url = make_url(uri)
                 db_engine = models.Database.get_db_engine_spec_for_backend(url.get_backend_name())
                 db_engine.patch()
-            
+
                 masked_url = database.get_password_masked_url_from_uri(uri)
                 logging.info("Superset.testconn(). Masked URL: {0}".format(masked_url))
 
diff --git a/superset/views/sql_lab.py b/superset/views/sql_lab.py
index eea71d4..7748b87 100644
--- a/superset/views/sql_lab.py
+++ b/superset/views/sql_lab.py
@@ -1,14 +1,12 @@
-from flask import redirect, g
-
+from flask import g, redirect
 from flask_appbuilder import expose
 from flask_appbuilder.models.sqla.interface import SQLAInterface
-
 from flask_babel import gettext as __
 from flask_babel import lazy_gettext as _
 
 from superset import appbuilder
 from superset.models.sql_lab import Query, SavedQuery
-from .base import SupersetModelView, BaseSupersetView, DeleteMixin
+from .base import BaseSupersetView, DeleteMixin, SupersetModelView
 
 
 class QueryView(SupersetModelView):
diff --git a/superset/viz.py b/superset/viz.py
index 025e9c5..4a3d048 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -8,29 +8,28 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
+from collections import defaultdict
 import copy
+from datetime import datetime, timedelta
 import hashlib
 import inspect
+from itertools import product
 import logging
 import traceback
 import uuid
 import zlib
 
-from collections import defaultdict
-from itertools import product
-from datetime import datetime, timedelta
-
-import pandas as pd
-import numpy as np
+from dateutil import relativedelta as rdelta
 from flask import request
 from flask_babel import lazy_gettext as _
 from markdown import markdown
+import numpy as np
+import pandas as pd
 import simplejson as json
-from six import string_types, PY3
+from six import PY3, string_types
 from six.moves import reduce
-from dateutil import relativedelta as rdelta
 
-from superset import app, utils, cache, get_manifest_file
+from superset import app, cache, get_manifest_file, utils
 from superset.utils import DTTM_ALIAS, merge_extra_filters
 
 config = app.config
diff --git a/tests/access_tests.py b/tests/access_tests.py
index 8fa1fb5..2e81fc0 100644
--- a/tests/access_tests.py
+++ b/tests/access_tests.py
@@ -5,16 +5,15 @@ from __future__ import print_function
 from __future__ import unicode_literals
 
 import json
-import mock
 import unittest
 
-from superset import db, sm, security
+import mock
 
-from superset.models import core as models
+from superset import db, security, sm
 from superset.connectors.connector_registry import ConnectorRegistry
-from superset.connectors.sqla.models import SqlaTable
 from superset.connectors.druid.models import DruidDatasource
-
+from superset.connectors.sqla.models import SqlaTable
+from superset.models import core as models
 from .base_tests import SupersetTestCase
 
 ROLE_TABLES_PERM_DATA = {
diff --git a/tests/base_tests.py b/tests/base_tests.py
index 1a0dbf8..0b76277 100644
--- a/tests/base_tests.py
+++ b/tests/base_tests.py
@@ -4,18 +4,18 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-import logging
 import json
+import logging
 import os
 import unittest
 
 from flask_appbuilder.security.sqla import models as ab_models
 
-from superset import app, cli, db, appbuilder, security, sm
+from superset import app, appbuilder, cli, db, security, sm
+from superset.connectors.druid.models import DruidCluster, DruidDatasource
+from superset.connectors.sqla.models import SqlaTable
 from superset.models import core as models
 from superset.security import sync_role_definitions
-from superset.connectors.sqla.models import SqlaTable
-from superset.connectors.druid.models import DruidCluster, DruidDatasource
 
 os.environ['SUPERSET_CONFIG'] = 'tests.superset_test_config'
 
diff --git a/tests/celery_tests.py b/tests/celery_tests.py
index ce88caf..c76341c 100644
--- a/tests/celery_tests.py
+++ b/tests/celery_tests.py
@@ -9,19 +9,19 @@ import os
 import subprocess
 import time
 import unittest
-from past.builtins import basestring
 
 import pandas as pd
+from past.builtins import basestring
 
-from superset import app, appbuilder, cli, db, dataframe
+from superset import app, appbuilder, cli, dataframe, db
 from superset.models import core as models
 from superset.models.helpers import QueryStatus
 from superset.models.sql_lab import Query
 from superset.security import sync_role_definitions
 from superset.sql_parse import SupersetQuery
-
 from .base_tests import SupersetTestCase
 
+
 BASE_DIR = app.config.get('BASE_DIR')
 
 
diff --git a/tests/core_tests.py b/tests/core_tests.py
index 7d1b2fd..41556d1 100644
--- a/tests/core_tests.py
+++ b/tests/core_tests.py
@@ -6,21 +6,20 @@ from __future__ import unicode_literals
 
 import csv
 import doctest
+import io
 import json
 import logging
-import io
 import random
 import unittest
 
 from flask import escape
 import sqlalchemy as sqla
 
-from superset import db, utils, appbuilder, sm, jinja_context, sql_lab
+from superset import appbuilder, db, jinja_context, sm, sql_lab, utils
+from superset.connectors.sqla.models import SqlaTable
 from superset.models import core as models
 from superset.models.sql_lab import Query
 from superset.views.core import DatabaseView
-from superset.connectors.sqla.models import SqlaTable
-
 from .base_tests import SupersetTestCase
 
 
diff --git a/tests/druid_tests.py b/tests/druid_tests.py
index c562c8d..e514751 100644
--- a/tests/druid_tests.py
+++ b/tests/druid_tests.py
@@ -10,12 +10,11 @@ import unittest
 
 from mock import Mock, patch
 
-from superset import db, sm, security
+from superset import db, security, sm
 from superset.connectors.druid.models import (
-    DruidMetric, DruidCluster, DruidDatasource
+    DruidCluster, DruidDatasource, DruidMetric, Postaggregator, PyDruid,
+    Quantile,
 )
-from superset.connectors.druid.models import PyDruid, Quantile, Postaggregator
-
 from .base_tests import SupersetTestCase
 
 class PickableMock(Mock):
diff --git a/tests/email_tests.py b/tests/email_tests.py
index 4c505b2..bdb56ca 100644
--- a/tests/email_tests.py
+++ b/tests/email_tests.py
@@ -4,15 +4,15 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
+from email.mime.application import MIMEApplication
+from email.mime.multipart import MIMEMultipart
 import logging
-import mock
 import tempfile
 import unittest
 
-from superset import utils, app
+import mock
 
-from email.mime.multipart import MIMEMultipart
-from email.mime.application import MIMEApplication
+from superset import app, utils
 
 send_email_test = mock.Mock()
 
@@ -118,4 +118,4 @@ class EmailSmtpTest(unittest.TestCase):
         assert not mock_smtp_ssl.called
 
 if __name__ == '__main__':
-    unittest.main()
\ No newline at end of file
+    unittest.main()
diff --git a/tests/import_export_tests.py b/tests/import_export_tests.py
index 0553635..83ae46b 100644
--- a/tests/import_export_tests.py
+++ b/tests/import_export_tests.py
@@ -4,18 +4,18 @@ from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
 
-from sqlalchemy.orm.session import make_transient
-
 import json
 import pickle
 import unittest
 
+from sqlalchemy.orm.session import make_transient
+
 from superset import db
-from superset.models import core as models
 from superset.connectors.druid.models import (
-    DruidDatasource, DruidColumn, DruidMetric)
-from superset.connectors.sqla.models import SqlaTable, TableColumn, SqlMetric
-
+    DruidColumn, DruidDatasource, DruidMetric,
+)
+from superset.connectors.sqla.models import SqlaTable, SqlMetric, TableColumn
+from superset.models import core as models
 from .base_tests import SupersetTestCase
 
 
diff --git a/tests/security_tests.py b/tests/security_tests.py
index c107024..ac7e0c8 100644
--- a/tests/security_tests.py
+++ b/tests/security_tests.py
@@ -1,5 +1,4 @@
 from superset import security, sm
-
 from .base_tests import SupersetTestCase
 
 
diff --git a/tests/sqllab_tests.py b/tests/sqllab_tests.py
index 29d74f4..e0b6701 100644
--- a/tests/sqllab_tests.py
+++ b/tests/sqllab_tests.py
@@ -9,9 +9,9 @@ import json
 import unittest
 
 from flask_appbuilder.security.sqla import models as ab_models
-from superset import db, utils, appbuilder, sm
-from superset.models.sql_lab import Query
 
+from superset import appbuilder, db, sm, utils
+from superset.models.sql_lab import Query
 from .base_tests import SupersetTestCase
 
 
diff --git a/tests/utils_tests.py b/tests/utils_tests.py
index b642c43..1aea191 100644
--- a/tests/utils_tests.py
+++ b/tests/utils_tests.py
@@ -1,24 +1,16 @@
-from datetime import datetime, date, timedelta, time
+from datetime import date, datetime, time, timedelta
 from decimal import Decimal
-from superset.utils import (
-    json_int_dttm_ser,
-    json_iso_dttm_ser,
-    base_json_conv,
-    parse_human_timedelta,
-    zlib_compress,
-    zlib_decompress_to_string,
-    merge_extra_filters,
-    datetime_f,
-    JSONEncodedDict,
-    validate_json,
-    SupersetException,
-)
 import unittest
 import uuid
 
 from mock import patch
 import numpy
 
+from superset.utils import (
+    base_json_conv, datetime_f, json_int_dttm_ser, json_iso_dttm_ser,
+    JSONEncodedDict, merge_extra_filters, parse_human_timedelta,
+    SupersetException, validate_json, zlib_compress, zlib_decompress_to_string,
+)
 
 class UtilsTestCase(unittest.TestCase):
     def test_json_int_dttm_ser(self):
diff --git a/tests/viz_tests.py b/tests/viz_tests.py
index 3e97656..111c86c 100644
--- a/tests/viz_tests.py
+++ b/tests/viz_tests.py
@@ -1,11 +1,12 @@
+from datetime import datetime, timedelta
 import unittest
+
+from mock import Mock, patch
 import pandas as pd
-import superset.viz as viz
-import superset.utils as utils
 
+import superset.utils as utils
 from superset.utils import DTTM_ALIAS
-from mock import Mock, patch
-from datetime import datetime, timedelta
+import superset.viz as viz
 
 class BaseVizTestCase(unittest.TestCase):
     def test_constructor_exception_no_datasource(self):
diff --git a/tox.ini b/tox.ini
index f3420a5..5e197a0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -45,10 +45,6 @@ ignore =
     F401
     F403
     F405
-    I100
-    I101
-    I201
-    I202
     Q000
     Q001
     W291

-- 
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <commits@superset.apache.org>'].

Mime
View raw message