diff options
Diffstat (limited to 'qutebrowser/commands/command.py')
-rw-r--r-- | qutebrowser/commands/command.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index eee5b7cde..cfae87958 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -403,21 +403,12 @@ class Command: raise TypeError("{}: Legacy tuple type annotation!".format( self.name)) - try: - origin = typing.get_origin(typ) # type: ignore[attr-defined] - except AttributeError: - # typing.get_origin was added in Python 3.8 - origin = getattr(typ, '__origin__', None) - + origin = typing.get_origin(typ) if origin is Union: - try: - types = list(typing.get_args(typ)) # type: ignore[attr-defined] - except AttributeError: - # typing.get_args was added in Python 3.8 - types = list(typ.__args__) - + types = list(typing.get_args(typ)) if param.default is not inspect.Parameter.empty: types.append(type(param.default)) + choices = self.get_arg_info(param).choices value = argparser.multitype_conv(param, types, value, str_choices=choices) |