Skip to content

Commit c3f4dbc

Browse files
authored
Resolve '__getitem__' requires a 'typing.Union' error (#336)
Fixes #330 Thanks to @ocervell for the patch
1 parent c433870 commit c3f4dbc

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

cadwyn/schema_generation.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,7 @@ def _change_version_of_a_non_container_annotation(self, annotation: Any) -> Any:
629629
use_cache=annotation.use_cache,
630630
)
631631
elif isinstance(annotation, UnionType): # pragma: no cover
632-
getitem = typing.Union.__getitem__ # pyright: ignore[reportAttributeAccessIssue]
633-
return getitem(
634-
tuple(self.change_version_of_annotation(a) for a in get_args(annotation)),
635-
)
632+
return typing.Union[tuple(self.change_version_of_annotation(a) for a in get_args(annotation))]
636633
elif is_any(annotation) or is_newtype(annotation):
637634
return annotation
638635
elif isinstance(annotation, type):

0 commit comments

Comments
 (0)