Skip to content
This repository has been archived by the owner on May 1, 2022. It is now read-only.

Commit

Permalink
Added support for | union syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
AstreaTSS committed Dec 19, 2021
1 parent 68899a5 commit 831fe9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion molter/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import inspect
import typing
from types import NoneType
from types import UnionType

import attr
import dis_snek
Expand Down Expand Up @@ -72,7 +73,7 @@ def _get_params(func: typing.Callable):

anno = param.annotation

if typing.get_origin(anno) == typing.Union:
if typing.get_origin(anno) in {typing.Union, UnionType}:
for arg in typing.get_args(anno):
if arg != NoneType:
converter = _get_converter(arg)
Expand Down

0 comments on commit 831fe9f

Please sign in to comment.