From e9127ce9985ce84bf2665ea82cd795c0f82abe45 Mon Sep 17 00:00:00 2001 From: benpankow Date: Sun, 1 Oct 2023 15:36:19 -0700 Subject: [PATCH] update comment a bit more --- .../dagster/dagster/_config/pythonic_config/type_check_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python_modules/dagster/dagster/_config/pythonic_config/type_check_utils.py b/python_modules/dagster/dagster/_config/pythonic_config/type_check_utils.py index d929e3ccb30cf..ca432a32afb08 100644 --- a/python_modules/dagster/dagster/_config/pythonic_config/type_check_utils.py +++ b/python_modules/dagster/dagster/_config/pythonic_config/type_check_utils.py @@ -42,6 +42,8 @@ def is_optional(annotation: Type) -> bool: # The Python 3.10 pipe syntax evaluates to a UnionType # rather than a Union, so we need to check for that as well + # UnionType values are equivalent to Unions, e.g. str | None == Union[str, None] + # but the types themselves are not, e.g. type(str | None) != type(Union[str, None]) if get_origin(annotation) == UnionType: return len(get_args(annotation)) == 2 and type(None) in get_args(annotation)