]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fix mypy on python<3.10
authorFederico Caselli <cfederico87@gmail.com>
Fri, 15 Mar 2024 19:42:16 +0000 (20:42 +0100)
committerFederico Caselli <cfederico87@gmail.com>
Fri, 15 Mar 2024 19:42:16 +0000 (20:42 +0100)
Change-Id: Ice16ff3685f89c64607ef37a906e17c53a5324fd

test/typing/plain_files/orm/mapped_covariant.py

index 680e925de3641e3508f27ff71f5280e8bc38c326..0b65073fde6eda09695cb6f883f25a8aa4dbf4ec 100644 (file)
@@ -1,6 +1,7 @@
 """Tests Mapped covariance."""\r
 \r
 from datetime import datetime\r
+from typing import List\r
 from typing import Protocol\r
 from typing import Sequence\r
 from typing import TypeVar\r
@@ -62,15 +63,15 @@ assert get_parent_name(Child(parent=Parent(name="foo"))) == "foo"
 \r
 # Make sure that relationships are covariant as well\r
 _BaseT = TypeVar("_BaseT", bound=Base, covariant=True)\r
-RelationshipType = (\r
-    InstrumentedAttribute[_BaseT]\r
-    | InstrumentedAttribute[Sequence[_BaseT]]\r
-    | InstrumentedAttribute[_BaseT | None]\r
-)\r
+RelationshipType = Union[\r
+    InstrumentedAttribute[_BaseT],\r
+    InstrumentedAttribute[Sequence[_BaseT]],\r
+    InstrumentedAttribute[Union[_BaseT, None]],\r
+]\r
 \r
 \r
 def operate_on_relationships(\r
-    relationships: list[RelationshipType[_BaseT]],\r
+    relationships: List[RelationshipType[_BaseT]],\r
 ) -> int:\r
     return len(relationships)\r
 \r