Skip to content

Commit

Permalink
ENH: apps now allow union type hints with | notation
Browse files Browse the repository at this point in the history
  • Loading branch information
rmcar17 committed May 1, 2024
1 parent e195488 commit 2c1900c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cogent3/app/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import re

from typing import ForwardRef, TypeVar, Union
from types import UnionType

from typing_extensions import get_args, get_origin

Expand Down Expand Up @@ -75,7 +76,7 @@ def get_constraint_names(*hints) -> set[str | type]:
all_hints.update(hint.__constraints__)
continue

if get_origin(hint) in (Union, list, tuple, set):
if get_origin(hint) in (Union, UnionType, list, tuple, set):
all_hints.update(get_constraint_names(*get_args(hint)))

if type(hint) == type:
Expand Down

0 comments on commit 2c1900c

Please sign in to comment.