| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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 759a54d28ffe7eac8c23917f5d3dfad8309856be)
|
| |
|
|
|
|
|
|
| |
choices (GH-117766) (GH-125432)
(cherry picked from commit 66b3922b97388c328c9bd8df050eef11c0261fae)
Signed-off-by: Jan Chren ~rindeal <dev.rindeal@gmail.com>
Co-authored-by: rindeal <dev.rindeal@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
(GH-125273) (GH-125360)
This was a regression introduced in gh-58573. It was only tested for the
case when the ambiguous option is the last argument in the command line.
(cherry picked from commit 63cf4e914f879ee28a75c02e867baa7c6047ea2b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
argparse (GH-125210) (GH-125309)
Previously, all nested mutually exclusive groups lost their connection
to the group containing them and were displayed as belonging directly
to the parser.
(cherry picked from commit 18c74497681e0107d7cde53e63ea42feb38f2176)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Danica J. Sutherland <djsutherland@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
argparse (GH-124782) (GH-124881)
Previously, formatting help output or error message for positional argument
with a tuple metavar raised exception.
(cherry picked from commit 9b31a2d83fa7cb0fe4d75ce7cf6a2c9ea2ce0728)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Cyker Way <cykerway@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
parent parser and subparsers in argparse (GH-124631) (GH-124759)
Check for ambiguous options if the option is consumed, not when it is
parsed.
(cherry picked from commit 3f27153e077d7e9448e2f081275931968b40cc74)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
dict (GH-124667) (GH-124758)
It now always uses setattr() instead of setting the dict item to modify
the namespace. This allows to use a class as a namespace.
(cherry picked from commit 95e92ef6c74e973ea13d15180190d0fa2af82fbf)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-124578) (GH-124756)
Substrings of the specified string no longer considered valid values.
(cherry picked from commit f1a2417b9e2993e584610851ac004c8b0599b323)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
| |
argparse (GH-124428) (GH-124754)
(cherry picked from commit 61180446eee2aef07b042c7e8892c45afabd1499)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
(GH-124519) (GH-124752)
type() no longer called for SUPPRESS.
This only affects positional arguments with nargs='?'.
(cherry picked from commit 9bcadf589ab6f7b9d309290de7a80156b6905d35)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
| |
(GH-124340) (GH-124750)
(cherry picked from commit 49e105f9488de18d3d92948232fcbd956cbe0c6e)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
| |
ArgumentParser.add_subparsers() (GH-27667) (GH-124505)
Call _() on literal strings only.
(cherry picked from commit d3c76dff444046504754a437dceebc9a9c87ef18)
Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
| |
(GH-124303) (GH-124437)
Fix parsing positional argument with nargs equal to '?' or '*' if it is
preceded by an option and another positional argument.
(cherry picked from commit 4a5e4aade420c594c5b3fe0589e9e6b444bd6ee5)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
non-required (GH-124306) (GH-124422)
This allows to use positional argument with nargs='*' and without default
in mutually exclusive group and improves error message about required
arguments.
(cherry picked from commit 3c83f9958c14cd62ad8951c53536f7788745b0ba)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
| |
command in argparse (GH-124275) (GH-124420)
(cherry picked from commit c578271366176a1d1b0941897efefb6e4d6508b4)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
(GH-124307) (GH-124419)
Arguments with the value identical to the default value (e.g. booleans,
small integers, empty or 1-character strings) are no longer considered
"not present".
(cherry picked from commit 3094cd17b0e5ba69309c54964744c797a70aa11b)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
(GH-124374)
In case of usage a long command along with max_help_position more than
the length of the command, the command's help was incorrectly started
on the new line.
(cherry picked from commit 7ee99217345af3010bf05b1f5241c661a5e0ea9b)
Co-authored-by: Savannah Ostrowski <savannahostrowski@gmail.com>
Co-authored-by: Pavel Ditenbir <pavel.ditenbir@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
(GH-124233) (GH-124267)
Only the first one has now been removed, all subsequent ones are now
taken literally.
(cherry picked from commit aae126748ff3d442fdbcd07933855ffd7ae6f59c)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
exit_on_error=False (GH-121056) (GH-121129)
* parse_intermixed_args() now raises ArgumentError instead of calling
error() if exit_on_error is false.
* Internal code now always raises ArgumentError instead of calling
error(). It is then caught at the higher level and error() is called if
exit_on_error is true.
(cherry picked from commit 81a654a3425eaa05a51342509089533c1f623f1b)
|
| |
|
|
|
|
|
| |
raises instead of exiting when given unrecognized arguments (GH-121019) (GH-121031)
(cherry picked from commit 0654336dd5138aec04e3017e15ccbb90a44e053d)
Co-authored-by: blhsing <blhsing@gmail.com>
|
| |
|
|
|
|
|
| |
(GH-115974)
(cherry picked from commit 6087315926fb185847a52559af063cc7d337d978)
Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
| |
localizable (GH-12711) (GH-115967)
(cherry picked from commit da382aaf52d761a037874bee27bb5db69906df9e)
Co-authored-by: paul.j3
Co-authored-by: Emmanuel Arias <eamanu@yaerobi.com>
Co-authored-by: Jérémie Detrey <jdetrey@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
exclusive group are suppressed (GH-96311) (GH-115767)
Reproducer depends on terminal size - the traceback occurs when there's
an option long enough so the usage line doesn't fit the terminal width.
Option order is also important for reproducibility.
Excluding empty groups (with all options suppressed) from inserts
fixes the problem.
(cherry picked from commit 5f7df88821347c5f44fc4e2c691e83a60a6c6cd5)
Co-authored-by: Daniel Mach <daniel.mach@suse.com>
|
| |
|
|
|
|
|
| |
ArgumentParser.parse_known_args() (GH-114180) (GH-115675)
(cherry picked from commit e47ecbd0420528f1f9f282d9e7acfcf586a4caa1)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
| |
(GH-114814) (GH-115036)
For example "--option=--".
(cherry picked from commit 4aa4f0906df9fc9c6c6f6657f2c521468c6b1688)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
| |
|
|
|
|
|
|
| |
`argparse.BooleanOptionalAction` (#103678)
Co-authored-by: Kirill <80244920+Eclips4@users.noreply.github.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net>
|
| | |
|
| |
|
|
|
|
| |
* In particular, don't exit when trying to print to stderr = None.
* Add tests
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
|
| |
|
|
| |
add_argument() were dropped (#102318)
|
| |
|
|
|
| |
Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
|
| |
|
|
|
|
|
|
| |
This removes the unused `name` variable in the block where `ArgumentTypeError` is handled.
`ArgumentTypeError` errors are handled by showing just the string of the exception; unlike `ValueError`, the name (`__name__`) of the function is not included in the error message.
Fixes #96548
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
similar to other actions (#27808)
Help for other actions omit the default value if default is SUPPRESS or
already contains the special format string '%(default)'. Add those
special cases to BooleanOptionalAction's help formatting too.
Fixes https://bugs.python.org/issue44587 so that default=SUPPRESS is not
emitted.
Fixes https://bugs.python.org/issue38956 as this code will detect
whether '%(default)s' has already been specified in the help string.
Signed-off-by: Micky Yun Chan (michiboo): <chanmickyyun@gmail.com>
Co-authored-by: Micky Yun Chan <michan@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
| |
Raise an ArgumentError when the same subparser name is added twice to an
ArgumentParser. This is consistent with the (default) behavior when the
same option string is added twice to an ArgumentParser.
(Support for `conflict_handler="resolve"` could be considered as a
followup feature, although real use cases seem even rarer than
"resolve"ing option-strings.)
Automerge-Triggered-By: GH:rhettinger
|
| |
|
|
|
|
|
|
|
| |
# Adding 'required' to names in Lib.argparse.Action
gh-91832:
Added 'required' to the list `names` in `Lib.argparse.Action`.
Changed constant strings that test the Action object.
Automerge-Triggered-By: GH:merwok
|
| |
|
|
|
| |
objects in argparse (#32257)" (#91771)
This reverts commit 328dbc051f84bd5fdf61101bb4fa61d85f8b7feb.
|
| |
|
|
|
|
|
| |
argparse (#32257)
* bpo-41395: Register a cleanup function to close files for FileType objects in argparse
* Added import as top level import, and renamed file as fh.
|
| |
|
|
|
|
|
| |
argument is '-' (GH-13165)
Also made modes containing 'a' or 'x' act the same as a mode containing 'w' when argument is '-'
(so 'a'/'x' return sys.stdout like 'w', and 'ab'/'xb' return sys.stdout.buffer like 'wb').
|
| | |
|
| |
|
|
|
| |
Fix an uncaught exception during help text generation when
argparse.BooleanOptionalAction is used with default=argparse.SUPPRESS
and help is specified.
|
| | |
|
| |
|
|
| |
exclusive groups (GH-30098)
|
| |
|
|
| |
(GH-30099)
|
| |
|
|
|
| |
* Revert "bpo-45235: Fix argparse overrides namespace with subparser defaults (GH-28420) (GH-28443)"
This reverts commit a18d52269ab6071a605d6c72f6af585a4c533ca4.
|
| |
|
|
| |
(GH-28050)
|
| | |
|
| |
|
|
| |
Co-authored-by: Micky Yun Chan <michan@redhat.com>
|
| |
|
|
| |
defaults to None. (GH-26707)
|