[issue43070] Control keys stop working after pressing Ctrl-C Escape Enter

2021-01-29 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: This is readline library feature. ESC-enter swithes it to vi mode. Press ESC-e to switch is back to emacs mode. See man readline. -- nosy: +monkeyman79 ___ Python tracker <https://bugs.python.org/issue43

[issue42966] argparse: customizable help formatter

2021-01-29 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: This is just repackaging old ideas into nice box. Instead of creating lambdas or generator function for each particular case, there is one easy to use, universal class. It will be finally written in official documentation how to change indentation

[issue42966] argparse: customizable help formatter

2021-01-29 Thread Tadek Kijkowski
Change by Tadek Kijkowski : -- keywords: +patch pull_requests: +23197 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24377 ___ Python tracker <https://bugs.python.org/issu

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-29 Thread Tadek Kijkowski
Change by Tadek Kijkowski : -- pull_requests: +23190 pull_request: https://github.com/python/cpython/pull/24367 ___ Python tracker <https://bugs.python.org/issue42

[issue14191] argparse doesn't allow optionals within positionals

2021-01-29 Thread Tadek Kijkowski
Change by Tadek Kijkowski : -- pull_requests: +23191 pull_request: https://github.com/python/cpython/pull/24367 ___ Python tracker <https://bugs.python.org/issue14

[issue43046] argparse: capturing actions

2021-01-27 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: > I'm a little confused by the mention of the "key" keyword argument. I suspect > that is an internal concept to argparse, possibly passed that way to internal > methods, but on the add_argument interface, it doesn't exist... instea

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-27 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: > So in the big picture, the purpose of this change is to treat the inputs like > a kind of state-machine. Not necessarily that. Simple parsers should be easy to write, complicated parsers should be _possible_ to write. Users should be able to do wh

[issue43046] argparse: capturing actions

2021-01-27 Thread Tadek Kijkowski
Change by Tadek Kijkowski : -- keywords: +patch pull_requests: +23181 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24357 ___ Python tracker <https://bugs.python.org/issu

[issue43046] argparse: capturing actions

2021-01-27 Thread Tadek Kijkowski
Change by Tadek Kijkowski : -- nosy: +paul.j3, r.david.murray, rhettinger, v+python ___ Python tracker <https://bugs.python.org/issue43046> ___ ___ Python-bug

[issue43046] argparse: capturing actions

2021-01-27 Thread Tadek Kijkowski
New submission from Tadek Kijkowski : This is spinoff from issue42973. The purpose of this issue is to provide set of additional action classes for argparse, that could capture mutual relationship between command line arguments for more advanced parsers, where order of command line arguments

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-27 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: I went with Paul's suggestion and added nargs='**' instead of greedy, so at this moment this PR doesn't introduce any changes in any public signatures. I'm working on 'capture' actions, but I want that to be a separate PR and a separate issue because

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-26 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: Paul, > The basic logic of argparse is to accept optionals in any order, and > positionals in strict positional order. 'nargs' allows us to pair any number > of strings with each optional's flag. I started this issue because that was insufficie

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-26 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: >> In the docs fruits example, though, I think the input and output are >> inconsistent: you have a brown banana reported as yellow? Yeah, I noticed that and fixed already :) I agree with your ideas. My goal was just to provide bare minimu

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-25 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: This is, I think, smallest functional example for matching optional parameters with positionals - fruits.py: import argparse DEFAULT_COLOR="plain" class AddFruitAction(argparse.Action): def __call__(self, parser, namespa

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-25 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: >> Is it up to the special handler of the positional parameter to read and save >> the values of the optional parameters specified so far? Yes, in order to get anything more that just concatenated list of positional parameters, one ha

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-25 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: I added tests and docs to the PR. How does it look now? -- ___ Python tracker <https://bugs.python.org/issue42973> ___ ___

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-20 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: >> I tried to checkout python sources, but even with -depth 1 it took too long >> for my patience and I gave up after 'du -sh .git' showed 2G. Ignore that. I must have been doing something worng. -- __

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-20 Thread Tadek Kijkowski
Tadek Kijkowski added the comment: >> Your example is incomplete. That is _CustomAction? What namespace does >> your patch produce. >> In your example I'd suggest making '--tracks' a nargs=2 and 'append' option. >> 'choices' would have to be replaced with

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-19 Thread Tadek Kijkowski
Change by Tadek Kijkowski : -- keywords: +patch pull_requests: +23083 stage: -> patch review pull_request: https://github.com/python/cpython/pull/24259 ___ Python tracker <https://bugs.python.org/issu

[issue14191] argparse doesn't allow optionals within positionals

2021-01-19 Thread Tadek Kijkowski
Change by Tadek Kijkowski : -- nosy: +monkeyman79 nosy_count: 9.0 -> 10.0 pull_requests: +23084 pull_request: https://github.com/python/cpython/pull/24259 ___ Python tracker <https://bugs.python.org/issu

[issue42973] argparse: mixing optional and positional arguments... not again

2021-01-19 Thread Tadek Kijkowski
New submission from Tadek Kijkowski : I have following use case for argparse: ./prog --tracks=80 image1 --tracks=40 image2 --tracks=80 image3 ... I expected that the following parser would be able process that command line: parser = argparse.ArgumentParser() add = parser.add_argument add

[issue42966] argparse: customizable help formatter

2021-01-19 Thread Tadek Kijkowski
Change by Tadek Kijkowski : -- title: argpare: customizable help formatter -> argparse: customizable help formatter ___ Python tracker <https://bugs.python.org/issu

[issue42966] argpare: customizable help formatter

2021-01-19 Thread Tadek Kijkowski
New submission from Tadek Kijkowski : Current implementation of the argparse module doesn't make it easy for developers to customize the help text message format. On one hand the module doesn't provide any builtin ways to do it, and the only way is to provide developer's own formatter class