Closed MartinHowarth closed 4 years ago
Describe the bug This dataclass:
@dataclass class MyCli: asdf: Tuple[str, ...]
gets parsed as: MyCli(asdf=(('asdf',), ('fgfh',))) but it should be: MyCli(asdf=('asdf', 'fgfh'))
MyCli(asdf=(('asdf',), ('fgfh',)))
MyCli(asdf=('asdf', 'fgfh'))
This works correctly with List instead of Tuple however.
To Reproduce Run the following with arguments --asdf asdf fgfh
--asdf asdf fgfh
from simple_parsing import ArgumentParser from dataclasses import dataclass from typing import * @dataclass class MyCli: asdf: Tuple[str, ...] parser = ArgumentParser() parser.add_arguments(MyCli, dest="args") args = parser.parse_args() print(args.args) # MyCli(asdf=(('asdf',), ('fgfh',))) print(args.args.asdf) # (('asdf',), ('fgfh',)) print(args.args.asdf[0]) # ('asdf',)
Expected behavior Should not result in each element of the tuple also being a single-element tuple.
Thanks for posting this!
Describe the bug This dataclass:
gets parsed as:
MyCli(asdf=(('asdf',), ('fgfh',)))
but it should be:MyCli(asdf=('asdf', 'fgfh'))
This works correctly with List instead of Tuple however.
To Reproduce Run the following with arguments
--asdf asdf fgfh
Expected behavior Should not result in each element of the tuple also being a single-element tuple.