]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
use typing.Dict
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Nov 2021 18:39:54 +0000 (13:39 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 18 Nov 2021 18:39:54 +0000 (13:39 -0500)
newer Pythons seem to accept ``dict[Any, Any]`` which is why
this wasn't noticed.  Revise fix for #7321 made in
I55656e867876677c5c55143449db371344be8600.

Fixes: #7321
Change-Id: Idc22e15d098543e07853f4532cfd1aaae4dd6404

test/ext/mypy/files/issue_7321.py
test/ext/mypy/files/issue_7321_part2.py

index 6a40b9ddaa0d23acab601cad0fe48a1afe64b0a4..d4cd7f2c4352416013ffc0860d6d02eed0563094 100644 (file)
@@ -1,4 +1,5 @@
 from typing import Any
+from typing import Dict
 
 from sqlalchemy.orm import declarative_base
 from sqlalchemy.orm import declared_attr
@@ -13,9 +14,9 @@ class Foo(Base):
         return "name"
 
     @declared_attr
-    def __mapper_args__(cls) -> dict[Any, Any]:
+    def __mapper_args__(cls) -> Dict[Any, Any]:
         return {}
 
     @declared_attr
-    def __table_args__(cls) -> dict[Any, Any]:
+    def __table_args__(cls) -> Dict[Any, Any]:
         return {}
index f53add1da9c2c58a451ade66f8f93fc1d10bbd3b..4227f2797e898eaf497abf2be2d7e142c0f92c85 100644 (file)
@@ -1,4 +1,5 @@
 from typing import Any
+from typing import Dict
 from typing import Type
 
 from sqlalchemy.orm import declarative_base
@@ -16,12 +17,12 @@ class Foo(Base):
         return "name"
 
     @declared_attr
-    def __mapper_args__(cls: Type["Foo"]) -> dict[Any, Any]:
+    def __mapper_args__(cls: Type["Foo"]) -> Dict[Any, Any]:
         return {}
 
     # this was a workaround that works if there's no plugin present, make
     # sure that doesn't crash anything
     @classmethod
     @declared_attr
-    def __table_args__(cls: Type["Foo"]) -> dict[Any, Any]:
+    def __table_args__(cls: Type["Foo"]) -> Dict[Any, Any]:
         return {}