From 831fe9f4301dadf8a0eee21f0cdb3f3829b65b36 Mon Sep 17 00:00:00 2001 From: Sonic4999 Date: Sun, 19 Dec 2021 17:55:48 -0500 Subject: [PATCH] Added support for | union syntax --- molter/command.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/molter/command.py b/molter/command.py index d81b917..6cffe67 100644 --- a/molter/command.py +++ b/molter/command.py @@ -2,6 +2,7 @@ import inspect import typing from types import NoneType +from types import UnionType import attr import dis_snek @@ -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)