| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
prefix_chars (GH-18337) (GH-18543)
When `allow_abbrev` was first added, disabling the abbreviation of
long options broke the grouping of short flags ([bpo-26967](https://bugs.python.org/issue26967)). As a fix,
b1e4d1b603 (contained in v3.8) ignores `allow_abbrev=False` for a
given argument string if the string does _not_ start with "--"
(i.e. it doesn't look like a long option).
This fix, however, doesn't take into account that long options can
start with alternative characters specified via `prefix_chars`,
introducing a regression: `allow_abbrev=False` has no effect on long
options that start with an alternative prefix character.
The most minimal fix would be to replace the "starts with --" check
with a "starts with two prefix_chars characters". But
`_get_option_tuples` already distinguishes between long and short
options, so let's instead piggyback off of that check by moving the
`allow_abbrev` condition into `_get_option_tuples`.
https://bugs.python.org/issue39546
(cherry picked from commit 8edfc47baec7ff4cb1b9db83dd35c8ffc1d498a4)
Co-authored-by: Kyle Meyer <kyle@kyleam.com>
https://bugs.python.org/issue39546
Automerge-Triggered-By: @encukou
|
| |
|
|
| |
groups (GH-14976) (GH-15494) (GH-15624)
|
| |
|
|
|
|
|
|
|
|
| |
BPO -16970: Adding error message for invalid args
Applied the patch argparse-v2 patch issue 16970, ran patch check and the test suite, test_argparse with 0 errors
https://bugs.python.org/issue16970
(cherry picked from commit 4b3e97592376d5f8a3b75192b399a2da1be642cb)
Co-authored-by: tmblweed <tmblweed@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The `allow_abbrev` option for ArgumentParser is documented and intended to disable support for unique prefixes of --options, which may sometimes be ambiguous due to deferred parsing.
However, the initial implementation also broke parsing of grouped short flags, such as `-ab` meaning `-a -b` (or `-a=b`). Checking the argument for a leading `--` before rejecting it fixes this.
This was prompted by pytest-dev/pytestGH-5469, so a backport to at least 3.8 would be great :smile:
And this is my first PR to CPython, so please let me know if I've missed anything!
https://bugs.python.org/issue26967
(cherry picked from commit dffca9e925ee5c3072663cbe8d4d4768406d5307)
Co-authored-by: Zac Hatfield-Dodds <Zac-HD@users.noreply.github.com>
|
| |
|
| |
(cherry picked from commit 8f4ef3b019ce380022018587571b0f970e668de3)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
add_argument (GH-13805)
There is a possibility that someone (like me) accidentally will omit parentheses with `FileType` arguments after `FileType`, and parser will contain wrong file until someone will try to use it.
Example:
```python
parser = argparse.ArgumentParser()
parser.add_argument('-x', type=argparse.FileType)
```
https://bugs.python.org/issue37150
(cherry picked from commit 03d5831a2d62c68654ec223168e574cd546efbf6)
Co-authored-by: zygocephalus <grrrr@protonmail.com>
|
| |
|
|
|
|
| |
Add an extend action to argparse
https://bugs.python.org/issue23378
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
- bugfix and test for fragile metavar handling in argparse (see
bpo-24089, bpo-14046, bpo-25058, bpo-11874)
- also fixes some incorrect tests that did not make 1-element tuples correctly
|
| |
|
|
|
|
|
|
|
| |
bpo-26510 in 3.7.0a2 changed the behavior of argparse to make
subparsers required by default, returning to the behavior of 2.7
and 3.2. The behavior was changed in 3.3 to be no longer required.
While it might make more sense to have the default to required,
compatibility with 3.3 through 3.6 is probably less disruptive
than trying to reintroduce compatibility with 2.7 at this point.
This change restores the 3.6 behavior.
|
| |
|
|
|
|
| |
This fixes a regression from Python 2. To get optional subparsers,
use the new parameter ``add_subparsers(required=False)``.
Patch by Anthony Sottile.
|
| |
|
| |
This adds support for parsing a command line where options and positionals are intermixed as is common in many unix commands. This is paul.j3's patch with a few tweaks.
|
| | |
|
| |\ |
|
| | | |
|
| |\ \
| |/ |
|
| | | |
|
| | | |
|
| | | |
|
| |\ \
| |/ |
|
| | | |
|
| |\ \
| |/ |
|
| | |\ |
|
| | | | |
|
| |/ /
| |
| |
| | |
Patch by Matthias Bussonnier.
|
| |\ \
| |/
| |
| | |
TestHelpVersionOptional was redundant.
|
| | |
| |
| |
| | |
TestHelpVersionOptional was redundant.
|
| | |
| |
| |
| | |
Patch by Jonathan Paugh, Steven Bethard, paul j3 and Daniel Eriksson.
|
| | |
| |
| |
| | |
implementation in issue #21408 they are redundant.
|
| |\ \
| |/ |
|
| | |
| |
| |
| | |
Patch by Karan Goel.
|
| |\ \
| |/ |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
Before, if a default was set on the parent parser, any default for that
variable set via set_defaults on a subparser would be ignored. Now
the subparser set_defaults is honored.
Patch by Jyrki Pullianinen.
|
| |\ \
| |/ |
|
| | | |
|
| |/
|
|
| |
Initial patch by Denver Coneybeare and Radu Voicilas.
|
| |
|
|
| |
comparing to unknown types.
|
| | |
|
| |\
| |
| |
| |
| | |
a help on environment with too small COLUMNS. Based on patch by
Elazar Gershuni.
|
| | |
| |
| |
| |
| | |
a help on environment with too small COLUMNS. Based on patch by
Elazar Gershuni.
|
| | |
| |
| |
| |
| |
| | |
output to stdout, matching the 'python -v'
Reported by Wolfgang Maier
|
| |/
|
|
| |
Patch by Lucas Maystre.
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
on the action's default, reverting it back to previous behavior. Conversion
is only done on string defaults.
Add a test for this and another test that ensures such type conversions are
only called once.
|
| |\ \
| |/
| |
| | |
when action='append', type='str' and default=[].
|
| | |
| |
| |
| | |
when action='append', type='str' and default=[].
|
| |\ \
| |/
| |
| |
| |
| |
| |
| | |
This fixes a regression introduced by the fix for issue #13922. Although args
is not documented as being allowed to be a tuple, previously this worked and
so naturally there are programs in the field that depend on it.
Patch by Zbyszek Jędrzejewski-Szmek.
|
| | |
| |
| |
| |
| |
| |
| |
| | |
This fixes a regression introduced by the fix for issue #13922. Although args
is not documented as being allowed to be a tuple, previously this worked and
so naturally there are programs in the field that depend on it.
Patch by Zbyszek Jędrzejewski-Szmek.
|