| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
WASI does not have the ``chmod(2)`` syscall yet.
|
|
|
|
|
|
| |
Add methods enterContext() and enterClassContext() in TestCase.
Add method enterAsyncContext() in IsolatedAsyncioTestCase.
Add function enterModuleContext().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
(GH-91986)
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
| |
Instead of explicitly enumerate test classes for run_unittest()
use the unittest ability to discover tests. This also makes these
tests discoverable and runnable with unittest.
load_tests() can be used for dynamic generating tests and adding
doctests. setUpModule(), tearDownModule() and addModuleCleanup()
can be used for running code before and after all module tests.
|
| |
|
|
|
|
| |
Co-authored-by: Micky Yun Chan <michan@redhat.com>
|
|
|
|
| |
defaults to None. (GH-26707)
|
|
|
| |
Automerge-Triggered-By: GH:encukou
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* test__xxsubinterpreters
* test_builtin
* test_doctest
* test_exceptions
* test_opcodes
* test_support
* test_argparse
* test_baseexception
* test_bdb
* test_bool
* test_asdl_parser
|
| |
|
| |
|
|
|
|
| |
argparse.BooleanOptionalAction (GH-20623)
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-18337)
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
|
| |
|
|
|
| |
Co-Authored-By: remilapeyre <remi.lapeyre@henki.fr>
|
|
|
|
|
|
|
|
|
|
|
|
| |
argparse.ArgumentParser (GH-15362)
Co-Authored-by: Xuanji Li <xuanji@gmail.com>
https://bugs.python.org/issue9938
Automerge-Triggered-By: @matrixise
|
|
|
|
|
| |
(GH-14976)
Co-authored-by: Andrew Nester <andrew.nester.dev@gmail.com>
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
| |
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/pytest#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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
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.
|
| |
|
|\ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
| | |
|
| | |
|
|\ \
| |/ |
|
| | |
|