From 866d3ccccaa3da85a4a1dda04f96de205a39d5d2 Mon Sep 17 00:00:00 2001 From: Mikko Korpela Date: Sun, 6 Aug 2023 16:04:51 +0300 Subject: [PATCH] bwic --- overrides/typing_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/overrides/typing_utils.py b/overrides/typing_utils.py index 038d375..e3e2804 100644 --- a/overrides/typing_utils.py +++ b/overrides/typing_utils.py @@ -36,6 +36,11 @@ else: _TypedDictMeta = None +if hasattr(types, "UnionType"): + UnionType = getattr(types, "UnionType") +else: + UnionType = None + unknown = None @@ -63,7 +68,7 @@ def is_union(element: object) -> bool: - return element is typing.Union or element is types.UnionType + return element is typing.Union or element is UnionType def optional_all(elements) -> typing.Optional[bool]: if all(elements):