From 34a974e509190497cd41831342dda0bdadf88891 Mon Sep 17 00:00:00 2001 From: Federico Caselli Date: Fri, 15 Mar 2024 20:42:16 +0100 Subject: [PATCH] fix mypy on python<3.10 Change-Id: Ice16ff3685f89c64607ef37a906e17c53a5324fd --- test/typing/plain_files/orm/mapped_covariant.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/typing/plain_files/orm/mapped_covariant.py b/test/typing/plain_files/orm/mapped_covariant.py index 680e925de3..0b65073fde 100644 --- a/test/typing/plain_files/orm/mapped_covariant.py +++ b/test/typing/plain_files/orm/mapped_covariant.py @@ -1,6 +1,7 @@ """Tests Mapped covariance.""" from datetime import datetime +from typing import List from typing import Protocol from typing import Sequence from typing import TypeVar @@ -62,15 +63,15 @@ assert get_parent_name(Child(parent=Parent(name="foo"))) == "foo" # Make sure that relationships are covariant as well _BaseT = TypeVar("_BaseT", bound=Base, covariant=True) -RelationshipType = ( - InstrumentedAttribute[_BaseT] - | InstrumentedAttribute[Sequence[_BaseT]] - | InstrumentedAttribute[_BaseT | None] -) +RelationshipType = Union[ + InstrumentedAttribute[_BaseT], + InstrumentedAttribute[Sequence[_BaseT]], + InstrumentedAttribute[Union[_BaseT, None]], +] def operate_on_relationships( - relationships: list[RelationshipType[_BaseT]], + relationships: List[RelationshipType[_BaseT]], ) -> int: return len(relationships) -- 2.47.2