argparse_dataclass
argparse_dataclass copied to clipboard
Is nested dataclass supported?
from argparse_dataclass import dataclass
from argparse_dataclass import ArgumentParser
@dataclass
class SubOption:
a: int = 1
b: int = 2
@dataclass
class Options:
x: int = 42
y: bool = False
sub: SubOption = None
parser = ArgumentParser(Options)
x = parser.parse_args(['--sub', '1'])
print(x)
for example, how can I parse args to get a value for sub?
This example doesn't make much sense to me. What attribute of SubOption should be getting set to 1?
This example doesn't make much sense to me. What attribute of
SubOptionshould be getting set to 1?
I mean, if I have a nested dataclass for example Options, how can I set the values in SubOptions.
python test.py --sub.a 2 --sub.b 1 Seems this usage is not supported. How can I set the value of sub.a?
This example doesn't make much sense to me. What attribute of
SubOptionshould be getting set to 1?
Let me say it more clearly, in the following example, how can I set 'logging' to False?
