This is an automated email from the ASF dual-hosted git repository.

johnbodley 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 636ee5d  [mypy] Enforcing typing for superset.migrations (#9583)
636ee5d is described below

commit 636ee5d19af09debe49a45389ba97d12b3569e1f
Author: John Bodley <4567245+john-bod...@users.noreply.github.com>
AuthorDate: Sat Apr 18 23:24:32 2020 -0700

    [mypy] Enforcing typing for superset.migrations (#9583)
    
    Co-authored-by: John Bodley <john.bod...@airbnb.com>
---
 setup.cfg                  |  2 +-
 superset/migrations/env.py | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/setup.cfg b/setup.cfg
index 566633c..d58d80a 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -53,7 +53,7 @@ order_by_type = false
 ignore_missing_imports = true
 no_implicit_optional = true
 
-[mypy-superset.bin.*,superset.charts.*,superset.datasets.*,superset.dashboards.*,superset.commands.*,superset.common.*,superset.dao.*,superset.db_engine_specs.*,superset.db_engines.*,superset.examples.*]
+[mypy-superset.bin.*,superset.charts.*,superset.datasets.*,superset.dashboards.*,superset.commands.*,superset.common.*,superset.dao.*,superset.db_engine_specs.*,superset.db_engines.*,superset.examples.*,superset.migrations.*]
 check_untyped_defs = true
 disallow_untyped_calls = true
 disallow_untyped_defs = true
diff --git a/superset/migrations/env.py b/superset/migrations/env.py
index 048b2b2..37b0190 100755
--- a/superset/migrations/env.py
+++ b/superset/migrations/env.py
@@ -16,8 +16,11 @@
 # under the License.
 import logging
 from logging.config import fileConfig
+from typing import List
 
 from alembic import context
+from alembic.operations.ops import MigrationScript
+from alembic.runtime.migration import MigrationContext
 from flask import current_app
 from flask_appbuilder import Base
 from sqlalchemy import engine_from_config, pool
@@ -41,7 +44,7 @@ target_metadata = Base.metadata  # pylint: disable=no-member
 # ... etc.
 
 
-def run_migrations_offline():
+def run_migrations_offline() -> None:
     """Run migrations in 'offline' mode.
 
     This configures the context with just a URL
@@ -60,7 +63,7 @@ def run_migrations_offline():
         context.run_migrations()
 
 
-def run_migrations_online():
+def run_migrations_online() -> None:
     """Run migrations in 'online' mode.
 
     In this scenario we need to create an Engine
@@ -71,9 +74,9 @@ def run_migrations_online():
     # this callback is used to prevent an auto-migration from being generated
     # when there are no changes to the schema
     # reference: https://alembic.sqlalchemy.org/en/latest/cookbook.html
-    def process_revision_directives(
-        context, revision, directives
-    ):  # pylint: disable=redefined-outer-name, unused-argument
+    def process_revision_directives(  # pylint: disable=redefined-outer-name, 
unused-argument
+        context: MigrationContext, revision: str, directives: 
List[MigrationScript]
+    ) -> None:
         if getattr(config.cmd_opts, "autogenerate", False):
             script = directives[0]
             if script.upgrade_ops.is_empty():

Reply via email to