You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromdataclassesimportdataclass@dataclassclassConfig:
item_type: stritem_length: int
I would expect HfArgumentParser.parse_args_into_dataclasses to correctly parse parameters like --item-type or --item-length (with a hyphen instead of an underscore). Unfortunately, it doesn't:
If no long option strings were supplied, dest will be derived from the first short option string by stripping the initial - character. Any internal - characters will be converted to _ characters to make sure the string is a valid attribute name.
It is standard convention to use hyphens in long-option parameters (e.g., --file-type, not --file_type).
Your contribution
If there is no reason preventing this feature request to be accepted, yes, I could contribute to a PR.
I just want to know if there is a fundamental reason why this is not implemented yet.
The text was updated successfully, but these errors were encountered:
Feature request
Given a dataclass
I would expect
HfArgumentParser.parse_args_into_dataclasses
to correctly parse parameters like--item-type
or--item-length
(with a hyphen instead of an underscore). Unfortunately, it doesn't:throws an error because it is expecting
--item_type
and--item_length
.Motivation
argparse
.argparse
converts hyphens into underscores before assignment:--file-type
, not--file_type
).Your contribution
If there is no reason preventing this feature request to be accepted, yes, I could contribute to a PR.
I just want to know if there is a fundamental reason why this is not implemented yet.
The text was updated successfully, but these errors were encountered: