-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rewrite parse_intermixed_args() in argparse #125355
Labels
Comments
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Oct 12, 2024
* The parser is no longer temporary modified and can be used concurrently. * Default values are no long handled twice. * Report about missed arguments now contains names of all required optional and positional arguments. * Unknown options can be intermixed with positionals in parse_known_intermixed_args().
This also fixes support for required mutually exclusive groups containing positionals. |
picnixz
added
type-feature
A feature request or enhancement
stdlib
Python modules in the Lib dir
labels
Oct 13, 2024
serhiy-storchaka
added a commit
that referenced
this issue
Oct 22, 2024
* The parser no longer changes temporarily during parsing. * Default values are not processed twice. * Required mutually exclusive groups containing positional arguments are now supported. * The missing arguments report now includes the names of all required optional and positional arguments. * Unknown options can be intermixed with positional arguments in parse_known_intermixed_args().
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Oct 22, 2024
…H-125356) * The parser no longer changes temporarily during parsing. * Default values are not processed twice. * Required mutually exclusive groups containing positional arguments are now supported. * The missing arguments report now includes the names of all required optional and positional arguments. * Unknown options can be intermixed with positional arguments in parse_known_intermixed_args(). (cherry picked from commit 759a54d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka
added a commit
that referenced
this issue
Oct 22, 2024
) (GH-125834) * The parser no longer changes temporarily during parsing. * Default values are not processed twice. * Required mutually exclusive groups containing positional arguments are now supported. * The missing arguments report now includes the names of all required optional and positional arguments. * Unknown options can be intermixed with positional arguments in parse_known_intermixed_args(). (cherry picked from commit 759a54d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Oct 22, 2024
…ythonGH-125356) * The parser no longer changes temporarily during parsing. * Default values are not processed twice. * Required mutually exclusive groups containing positional arguments are now supported. * The missing arguments report now includes the names of all required optional and positional arguments. * Unknown options can be intermixed with positional arguments in parse_known_intermixed_args(). (cherry picked from commit 759a54d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka
added a commit
that referenced
this issue
Oct 22, 2024
) (GH-125839) * The parser no longer changes temporarily during parsing. * Default values are not processed twice. * Required mutually exclusive groups containing positional arguments are now supported. * The missing arguments report now includes the names of all required optional and positional arguments. * Unknown options can be intermixed with positional arguments in parse_known_intermixed_args(). (cherry picked from commit 759a54d)
ebonnal
pushed a commit
to ebonnal/cpython
that referenced
this issue
Jan 12, 2025
…H-125356) * The parser no longer changes temporarily during parsing. * Default values are not processed twice. * Required mutually exclusive groups containing positional arguments are now supported. * The missing arguments report now includes the names of all required optional and positional arguments. * Unknown options can be intermixed with positional arguments in parse_known_intermixed_args().
Wish the internal API for |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
parse_intermixed_args()
andparse_known_intermixed_args()
are implemented by parsing command lines twice -- first only optional arguments, then the remaining is parsed as positional arguments. This approach has some issues.parse_known_intermixed_args()
cannot be intermixed with positional arguments. Well, "parsing only known arguments" is a dubious feature, but still...I tried to rewrite the implementation by moving the code deeper. No longer parser patching, defaults are handled only once, unknown options are excluded from positionals parsing. @hpaulj, @bitdancer, as the authors of the original implementation, could you please review this code?
Linked PRs
The text was updated successfully, but these errors were encountered: