]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
updates for mypy 1.16
authorMike Bayer <mike_mp@zzzcomputing.com>
Sun, 8 Jun 2025 20:14:19 +0000 (16:14 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sun, 8 Jun 2025 20:14:19 +0000 (16:14 -0400)
some errors go away, others come in.   basically moving
ignores around.  need to pin to 1.16 at the lowest as these
would now fail on earlier mypy versions

Change-Id: Ia46084c69f1496ad77e215aab3fe1e6104361a96

alembic/autogenerate/compare.py
alembic/autogenerate/rewriter.py
alembic/runtime/environment.py
alembic/runtime/migration.py
alembic/script/base.py
tox.ini

index 66e31ca46cad6a2b664f580fe7513ecb273e3b94..cf43729bdf45ed67242471f8ca3d5e9073cae2e9 100644 (file)
@@ -1282,7 +1282,7 @@ def _compare_foreign_keys(
             obj.const, obj.name, "foreign_key_constraint", False, compare_to
         ):
             modify_table_ops.ops.append(
-                ops.CreateForeignKeyOp.from_constraint(const.const)  # type: ignore[has-type]  # noqa: E501
+                ops.CreateForeignKeyOp.from_constraint(const.const)
             )
 
             log.info(
index 8994dcf823cb3e40ddbab287cd7b80b166ae885b..1d44b5c340b7efc63302e7a78e4ac84d6fe1d4fe 100644 (file)
@@ -177,7 +177,7 @@ class Rewriter:
                 )
             upgrade_ops_list.append(ret[0])
 
-        directive.upgrade_ops = upgrade_ops_list  # type: ignore
+        directive.upgrade_ops = upgrade_ops_list
 
         downgrade_ops_list: List[DowngradeOps] = []
         for downgrade_ops in directive.downgrade_ops_list:
@@ -187,7 +187,7 @@ class Rewriter:
                     "Can only return single object for DowngradeOps traverse"
                 )
             downgrade_ops_list.append(ret[0])
-        directive.downgrade_ops = downgrade_ops_list  # type: ignore
+        directive.downgrade_ops = downgrade_ops_list
 
     @_traverse.dispatch_for(ops.OpContainer)
     def _traverse_op_container(
index 1ff71eef70ddc2f77853e06c09661c82a01741d4..80ca2b6ca3188bb4f0c8c854da14470618ef5518 100644 (file)
@@ -338,7 +338,7 @@ class EnvironmentContext(util.ModuleClsProxy):
             line.
 
         """
-        return self.context_opts.get("tag", None)  # type: ignore[no-any-return]  # noqa: E501
+        return self.context_opts.get("tag", None)
 
     @overload
     def get_x_argument(self, as_dictionary: Literal[False]) -> List[str]: ...
index ac431a620dcc9cb393766930c8ba92f25c0dec58..c1c7b0fc5da6efa920bdeac86bc48cf4803b627a 100644 (file)
@@ -175,7 +175,11 @@ class MigrationContext:
                 opts["output_encoding"],
             )
         else:
-            self.output_buffer = opts.get("output_buffer", sys.stdout)
+            self.output_buffer = opts.get(
+                "output_buffer", sys.stdout
+            )  # type:ignore[assignment]  # noqa: E501
+
+        self.transactional_ddl = transactional_ddl
 
         self._user_compare_type = opts.get("compare_type", True)
         self._user_compare_server_default = opts.get(
index 8c5d763f8312a99c9f0921cb17935433dcdcc653..16c014b852da54303556b4ad45e05f8a7b44c936 100644 (file)
@@ -846,7 +846,7 @@ class Script(revision.Revision):
                 doc = doc.decode(  # type: ignore[attr-defined]
                     self.module._alembic_source_encoding
                 )
-            return doc.strip()  # type: ignore[union-attr]
+            return doc.strip()
         else:
             return ""
 
diff --git a/tox.ini b/tox.ini
index 087db7edd085130f6eedefc22296236fdcb969e0..fad7ec275a85f1b16f1968c26e7c52c997627499 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -70,7 +70,7 @@ basepython =
     python312
     python313
 deps=
-    mypy
+    mypy>=1.16.0
     sqlalchemy>=2
     mako
     # is imported in alembic/testing and mypy complains if it's not installed.