[issue12686] argparse - document (and improve?) use of SUPPRESS with help=

2012-10-18 Thread Steven Bethard
Steven Bethard added the comment: Yeah, looks like we can close this. If anyone finds a specific bug in the use of SUPPRESS, please open a new issue. -- resolution: - duplicate status: open - closed superseder: - document argparse's help=SUPPRESS

[issue15935] clarify argparse docs re: add_argument() type and default arguments

2012-09-13 Thread Steven Bethard
Steven Bethard added the comment: Looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15935 ___ ___ Python-bugs-list mailing list

[issue15929] argparse non alphanum characters replacement

2012-09-12 Thread Steven Bethard
Steven Bethard added the comment: If you need to get things that aren't valid Python identifiers, use vars() to get the dictionary: http://docs.python.org/dev/library/argparse.html#the-namespace-object Changing all non-alphanumeric characters to underscores would be a backwards incompatible

[issue15906] argparse add_argument() confusing behavior when type=str, default=

2012-09-12 Thread Steven Bethard
Steven Bethard added the comment: It looks like the correct fix was already applied, but just to chime in here: (1) Yes, the error is that the isinstance(action.default, str) check was lost (2) Yes, it is intended that you can use a string value as your default and the type= converter

[issue15929] argparse non alphanum characters replacement

2012-09-12 Thread Steven Bethard
Steven Bethard added the comment: I haven't been following python-dev recently, but the only discussion I remember was for non-strings in __dict__, not non-identifiers. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15929

[issue15906] argparse add_argument() confusing behavior when type=str, default=

2012-09-12 Thread Steven Bethard
Steven Bethard added the comment: Oh, I see, you're right - the recent changes from the Roundup Robot are exactly the wrong changes - special casing _StoreAction, not string defaults. -- ___ Python tracker rep...@bugs.python.org http

[issue15906] argparse add_argument() confusing behavior when type=str, default=

2012-09-12 Thread Steven Bethard
Steven Bethard added the comment: I see. So right now, both string defaults and non-string defaults are being converted with the type= function. That seems suspect to me since the documentation explicitly says type= can take any callable that takes a single string argument and returns

[issue15906] argparse add_argument() confusing behavior when type=str, default=

2012-09-12 Thread Steven Bethard
Steven Bethard added the comment: Ok, sounds good. Let's make the test check the documented behavior, and then add back the isinstance(action.default, str) check. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15906

[issue15906] argparse add_argument() confusing behavior when type=str, default=

2012-09-12 Thread Steven Bethard
Steven Bethard added the comment: Patch, with the basestring amendment, looks good. Do we need a new test for conversion of string defaults? Yeah, I guess go ahead and add one. That will at least document our intentions here, and if we decide to change that later, then it will force us

[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

2012-09-07 Thread Steven Bethard
Steven Bethard added the comment: Interesting idea! The regex would need a little extra care to interoperate properly with prefix_chars, but the approach doesn't seem crazy. I'd probably call the constructor option something like args_default_to_positional (the current behavior is essentially

[issue15874] argparse cannot parse shell variable arguments in file-given arguments

2012-09-07 Thread Steven Bethard
Steven Bethard added the comment: You could try declaring a type converter and using the type= parameter of add_argument. Your type converter could look something like: def expanded_path(arg): return os.path.expandvars(arg) Would that work

[issue15847] parse_args stopped accepting tuples

2012-09-02 Thread Steven Bethard
Steven Bethard added the comment: The fix looks about right to me. There's a bug in the tests though: parser.parse_args(('x')) should probably be: parser.parse_args(('x',)) since I assume the intent was to test tuples. -- ___ Python

[issue15832] argparse: typechecks default value too early

2012-08-31 Thread Steven Bethard
Changes by Steven Bethard steven.beth...@gmail.com: -- resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15832

[issue15832] argparse: typechecks default value too early

2012-08-31 Thread Steven Bethard
Steven Bethard added the comment: It's a bug, but it's already been reported in Issue 12776. There's a patch there, but someone needs to commit it. -- superseder: - argparse: type conversion function should be called only once ___ Python tracker

[issue13922] argparse handling multiple -- in args improperly

2012-08-21 Thread Steven Bethard
Steven Bethard added the comment: @gcbirzan: Could you please open up a new issue? The current issue is fixed - it's just that the fix caused a new issue. I would say that the `args` parameter was never intended to be anything but a list, so currently there's a documentation bug since

[issue15433] argparse usage line is wrong

2012-07-23 Thread Steven Bethard
Changes by Steven Bethard steven.beth...@gmail.com: -- resolution: - duplicate superseder: - argparse optionals with nargs='+' can't be followed by positionals ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15433

[issue15433] argparse usage line is wrong

2012-07-23 Thread Steven Bethard
Changes by Steven Bethard steven.beth...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15433 ___ ___ Python

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2012-07-23 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: So Kotan's patch doesn't actually solve the original problem. Instead, it inserts the workaround into the help message of the parser. I think this is probably not the right fix. We should probably do two things: (1) Right now: create

[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2012-07-23 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: And I guess Issue 9182 is the right place for (1). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9338

[issue9182] document “--” as a way to distinguish option w/ narg='+' from positional argument in argparse

2012-07-23 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Ok, here's what I think needs to go into the documentation here: (1) Add a separate section to the argparse docs about '--'. Give examples like the ones in this issue, and show how '--' can solve them (2) Cross-reference the section

[issue13249] argparse.ArgumentParser() lists arguments in the wrong order

2012-07-23 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I've updated the patch for the current trunk. Should be ready to commit. -- Added file: http://bugs.python.org/file26490/Issue13249-4.patch ___ Python tracker rep...@bugs.python.org http

[issue14910] argparse: disable abbreviation

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I think it makes a lot of sense to allow people to disable abbreviations, so +1 on the feature request. The patch looked good. There was one typo - using accept_abbrev in the docstring instead of allow_abbrev as in the implementation

[issue14910] argparse: disable abbreviation

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Sorry, my mistake, the doc changes were already in the patch. I just checked them and they look good too. So everything's ready to commit. Thanks for your contribution! -- ___ Python

[issue8538] Add FlagAction to argparse

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: On the off chance that someone was waiting for feedback from me, I'll say: (1) A simple boolean --foo/--no-foo action seems useful to me. I would probably call it BooleanOptionalAction rather than FlagAction. (Almost anything could

[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The fix looks right, but we definitely need a test. I tried to write one, but I'm not sure how to do this properly given how test_argparse redirects standard input and output (so that fileno() doesn't work anymore). I've attached my

[issue11354] argparse: nargs could accept range of options count

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The tests look like they're testing the right things, but the tests should instead be written like the rest of the argparse tests. For example, look at TestOptionalsNargs3 and TestPositionalsNargs2. You could write your tests to look

[issue15112] argparse: nargs='*' positional argument doesn't accept any items if preceded by an option and another positional

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Your patch is a good start, but it needs to handle all the related situations, e.g. nargs='?' and the possibility of having more than one zero-length argument at the end. I believe the following patch achieves this. Please test it out

[issue15427] Describe use of args parameter of argparse.ArgumentParser.parse_args

2012-07-22 Thread Steven Bethard
New submission from Steven Bethard steven.beth...@gmail.com: From http://bugs.python.org/issue14191#msg155202: ArgumentParser.parse_args(args=None, namespace=None) ... However, nowhere is the args= parameter explained. One example is given at the end of 15.4.4.6 showing the use of args= which

[issue14191] argparse doesn't allow optionals within positionals

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I created Issue 15427 for the parse_args documentation bug. So let's make this issue just about parsing intermixed arguments. Yes, if someone would like to provide a patch for this, please create a method parse_intermixed_args rather

[issue15271] argparse: repeatedly specifying the same argument ignores the previous ones

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I don't think this is a bug. You've specified two arguments with the same destination, foo. This means that argparse will parse the first one, assign it to the attribute foo and then parse the second one and assign it to the attribute

[issue15125] argparse: positional arguments containing - in name not handled well

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I'm sympathetic to the idea that '-' should be translated similarly for optional and positional arguments, but as you've noted, it would be a risky patch because it's already possible for people to use getattr on hyphenated arguments

[issue11176] give more meaningful argument names in argparse documentation

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Thanks for working on this! I think keeping the first example as simple is possible is probably a good idea. And I didn't have time to read through the whole patch, but as far as I went, the pizza examples looked great

[issue15336] Argparse required arguments incorrectly displayed as optional arguments

2012-07-22 Thread Steven Bethard
Changes by Steven Bethard steven.beth...@gmail.com: -- resolution: - duplicate status: open - closed superseder: - argparse: Default Help Message Lists Required Args As Optional ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue9694] argparse required arguments displayed under optional arguments

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I'm changing the title because I keep seeing duplicates. Documentation patches still welcome! -- title: argparse: Default Help Message Lists Required Args As Optional - argparse required arguments displayed under optional

[issue15327] Argparse: main arguments and subparser arguments indistinguishable

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I don't think there's any easy way for argparse to automatically do what you want. However, there's a simple workaround - just use the dest= argument and specify two different destinations: parser = argparse.ArgumentParser

[issue15428] add Name Collision section to argparse docs

2012-07-22 Thread Steven Bethard
New submission from Steven Bethard steven.beth...@gmail.com: Several bugs (e.g. Issue 15327 and Issue 15271) have been filed suggesting that people aren't really clear on how argparse handles argument name collisions or how they can get it to do what they want. I think these problems could

[issue15327] Argparse: main arguments and subparser arguments indistinguishable

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: If you'd like to help improve the documentation so that the workaround for your problem is more obvious, please contribute to Issue 15428. -- ___ Python tracker rep...@bugs.python.org http

[issue15271] argparse: repeatedly specifying the same argument ignores the previous ones

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I'm going to close this issue, since argparse is doing what you've asked it to, even if that wasn't what you expected. But I think the documentation for this kind of thing could be improved. If you'd like to help document

[issue13720] argparse print_help() fails if COLUMNS is set to a low value

2012-07-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Definitely a bug here. Attached is a patch and a test, based on Russell Sim's suggestion, that should fix it. -- keywords: +patch versions: +Python 3.4 Added file: http://bugs.python.org/file26486/13720.patch

[issue13922] argparse handling multiple -- in args improperly

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: This patch looks like the right fix to me. The tests look good too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13922

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I think the real fix needs to search recursively though all subparsers. Here's a first draft of a patch that does this. I believe your sample code works after this patch. I don't have the time to turn your bug report into proper test

[issue14391] misc TYPO in argparse.Action docstring

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The patch supplied was in reverse, but the bug report was correct. You can't pass type=string since there's no string callable, only a str callable. The docstring is confusing because the quotes make it looks like we mean the string

[issue14392] type=bool doesn't raise error in argparse.Action

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I can't find anywhere in the documentation where type=bool, type=unicode or type=long are disallowed. They shouldn't be disallowed. If you want to pass type=bool, argparse should not stop you. And it currently doesn't: parser

[issue14449] argparse optional arguments should follow getopt_long(3)

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I don't think this is going to change. It's basically a consequence of having a unified handling of nargs='?', nargs='*', nargs='+', etc. These will all consume as many arguments as they can, and argparse doesn't distinguish between

[issue14504] Suggestion to improve argparse's help messages for store_const

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Special casing the formatting of 'store_const' makes me nervous because formatting is already complicated and it doesn't know anything about action types. But feel free to propose a patch! In the meantime: - propagate the default

[issue13824] argparse.FileType opens a file and never closes it

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: So I generally agree that FileType is not what you want for anything but quick scripts that can afford to either leave a file open or to close stdin and/or stdout. However, quick scripts are an important use case for argparse, so I

[issue12776] argparse: type conversion function should be called only once

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The patch looks good to me. I've updated it for trunk and to include Mike Meyer's additional test. All argparse tests pass. Anyone who's able to commit and backport, please do. (I should be able to commit myself, but it's now been too

[issue12353] argparse cannot handle empty arguments

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Yes, the original patch looks fine to me. I applied and tested it, and it works as expected. Please go ahead and apply. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue13966] Add disable_interspersed_args() to argparse.ArgumentParser

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The argparse changes and tests look good. The new method needs to be documented. You can see some other things (e.g. Misc/NEWS) that also need to be updated by running make patchcheck as described here: http://docs.python.org/devguide

[issue11807] Documentation of add_subparsers lacks information about parametres

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Looks good. There was one typo in parametres that I've fixed. Should be ready to apply. -- Added file: http://bugs.python.org/file26469/11807_3.patch ___ Python tracker rep

[issue13818] argparse: -h listening required options under optional arguments

2012-07-21 Thread Steven Bethard
Changes by Steven Bethard steven.beth...@gmail.com: -- resolution: - duplicate status: open - closed superseder: - argparse: Default Help Message Lists Required Args As Optional ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue9625] argparse: Problem with defaults for variable nargs when using choices

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I agree that this looks like a bug. I think the fix is something like the attached patch, but it needs some tests to make sure that it fixes your problem. -- keywords: +patch Added file: http://bugs.python.org/file26471

[issue14856] argparse: creating an already defined subparsers does not raises an exception

2012-07-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Yeah, overwriting the existing parser is probably not typically what the user intended. However, I could see someone doing this if, say, they had a parser designed by another module writer, and they wanted to use it but just change

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Ok, I agree - I'm fine with it as a bugfix. Depending on the removal of extra -- strings would be pretty crazy anyway. ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org

[issue14364] Argparse incorrectly handles '--'

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I just tried this with grep's -e and --regexp: $ cat temp.txt a--b cdef $ grep -e-- -v temp.txt cdef $ grep --regexp=-- -v temp.txt cdef $ grep -e -- -v temp.txt cdef $ grep --regexp -- -v temp.txt cdef And with diff's -I and --ignore

[issue13922] argparse handling multiple -- in args improperly

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: It prevents implementing parsers that pass strings on to another sub-parser or command. ... wouldn't you use 'parse_known_args' instead of 'parse_args' and pass the remaining arguments to the next script I'll just say again

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Yep. Closing as duplicate. -- resolution: - duplicate status: open - closed superseder: - argparse: allow abbreviation of sub commands by users ___ Python tracker rep...@bugs.python.org

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: My mistake. I see that the error you're getting is a bad interaction between the option in the main parser and an ambiguous option in the subparser. -- resolution: duplicate - status: closed - open superseder: argparse: allow

[issue14365] argparse: subparsers, argument abbreviations and ambiguous option

2012-03-18 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The problem is basically that _parse_known_args calls _parse_optional to determine whether something is an optional or a positional. But _parse_optional only checks if arg_string in self._option_string_actions, that is, if the string

[issue14191] argparse: nargs='*' doesn't get out-of-order positional parameters

2012-03-08 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Hence, I conclude that, unless this was spelled out in the PEP and I missed it, that having such boundaries is a bug Practically speaking, we just can't change this because it will break existing argparse scripts. Argparse has had

[issue14191] argparse: nargs='*' doesn't get out-of-order positional parameters

2012-03-08 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Thinking about it a bit more, it strikes me that maybe you could get the behavior you want by declaring two parsers, one with just optionals, and one with just positionals. Then: optional_args, remaining_args

[issue14191] argparse: nargs='*' doesn't get out-of-order positional parameters

2012-03-08 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Actually, that could be even simpler: args, remaining_args = optionals.parse_known_args() args = positionals.parse_args(remaining_args, args) -- ___ Python tracker rep...@bugs.python.org

[issue14191] argparse: nargs='*' doesn't get out-of-order positional parameters

2012-03-07 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: optparse, which argparse attempts to replace, permitted positional arguments to be intermixed with optional arguments Sure, but optparse didn't actually parse positional arguments - it just threw them into a bag, and then you had

[issue14191] argparse: nargs='*' doesn't get out-of-order positional parameters

2012-03-06 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: This behavior is intentional - positional arguments must be sequential, not broken up with optional (flag) arguments between. So this is a documentation bug. Allowing positional arguments to be broken up with optional (flag) arguments

[issue14149] argparse usage model requires argument names to be python identifiers

2012-02-29 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: For optional flags like --foo-bar, argparse does munge the dest to foo_bar, following optparse. For positional arguments, arpgarse doesn't munge things this way, but if you want the argument named foo-bar in help messages and foo_bar

[issue14149] argparse: Document how to use argument names that are not Python identifiers

2012-02-29 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: making Namespace subscriptable This has been discussed before - see issue 11076. I prefer to keep Namespace as simple as possible. For subscripting, just use the standard Python idiom of vars as suggested in the docs: http

[issue14156] argparse.FileType for '-' doesn't work for a mode of 'rb'

2012-02-29 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Yes, the problem is in FileType.__call__ - the handling of '-' is pretty simplistic. Patches welcome. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14156

[issue14046] argparse: assertion failure if optional argument has square/round brackets in metavar

2012-02-25 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Yes, this is a known bug (Issue 11874). Patches welcome. -- resolution: - duplicate superseder: - argparse assertion failure with brackets in metavars ___ Python tracker rep

[issue14074] argparse allows nargs1 for positional arguments but doesn't allow metavar to be a tuple

2012-02-25 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Looks like the problem is that _format_action_invocation is not being as careful with the different possibilities for metavar as _format_args is. Patches welcome! -- ___ Python tracker rep

[issue14075] argparse: unused method?

2012-02-25 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: It's undocumented, and it begins with an underscore, but it would certainly be safer to deprecate it first. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14075

[issue14102] argparse: add ability to create a man page

2012-02-24 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I think adding a new formatter for man pages would be generally useful. Assuming someone provides a patch. ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14102

[issue14103] argparse: add ability to create a bash_completion script

2012-02-24 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Yeah, the same issues have been discussed in Issue 4256. My feeling so far is that if there isn't one true format that argparse can produce and be useful to a wide variety of shells, then it's probably not functionality that belongs

[issue4256] argparse: provide a simple way to get a programmatically useful list of options

2012-02-24 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: So it seems like what bash needs and what zsh needs are pretty different. My feeling so far is that if there isn't one true format that argparse can produce and be useful to a wide variety of shells, then it's probably

[issue14034] Add argparse howto

2012-02-22 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Oh ok. Sounds good then! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14034

[issue14034] Add argparse howto

2012-02-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I have no objections on adding a howto, and something like the attached patch would be fine with me (though I don't have time to review it in full and trust you to). You might want to coordinate with Issue 13850 a bit - they want

[issue14075] argparse: unused method?

2012-02-21 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Yeah, the intention was that you could just override _get_args in a subclass to get a better __repr__. I think these days all the argparse classes only have keyword arguments, so _get_args probably isn't necessary anymore

[issue9253] argparse: optional subparsers

2012-02-20 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The implementation looks along the right track. Now it just needs some tests. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9253

[issue13922] argparse handling multiple -- in args improperly

2012-02-13 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: See nargs=argparse.REMAINDER for an approach that doesn't require that first '--': http://docs.python.org/library/argparse.html#nargs But yeah, removing more than one '--' is probably a bug. Fixing it would be a little backwards

[issue13966] Add disable_interspersed_args() to argparse.ArgumentParser

2012-02-10 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The idea and patch seem okay to me. Needs tests though. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13966

[issue13879] Argparse does not support subparser aliases in 2.7

2012-01-27 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: This is a new feature, not a bug, so I think the correct fix is to change the 2.7 documentation, since at this point 2.7 can only get bugfixes, not new features. -- ___ Python tracker rep

[issue13850] Summary tables for argparse add_argument options

2012-01-24 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Sounds like an excellent plan to me too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13850

[issue13685] argparse does not sanitize help strings for % signs

2012-01-10 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Eric's suggested doc fix looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13685

[issue13584] argparse doesn't respect double quotes

2011-12-16 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Closing then. Thanks for checking it again! -- assignee: - bethard resolution: - works for me stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue13540] Document the Action API in argparse

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Sorry about being out of contact (I'm flying back and forth between the US and the EU every 4-5 weeks right now), and thanks Terry for bringing this to my attention. Essentially, the API is: * The argument to action= must

[issue13584] argparse doesn't respect double quotes

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Can you submit some example code that shows this? I can't reproduce this with: -- temp.py -- import argparse parser = argparse.ArgumentParser() parser.add_argument(--ng, action=store_true) parser.add_argument(--INP

[issue12776] argparse: type conversion function should be called only once

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Could you add a test to verify that custom actions are still getting the converted values passed to their __call__? I suspect this may not be happening under the current patch - if that's the case, you may also need to add conversions

[issue10772] Several actions for argparse arguments missing from docs

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Looks good to me too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10772

[issue13249] argparse.ArgumentParser() lists arguments in the wrong order

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: The ArgumentParser constructor is definitely only intended to be called with keyword arguments, so it's definitely a documentation bug that it doesn't say this. I haven't actually applied the patch, but the basic approach and wording

[issue13271] When -h is used with argparse, default values that fail should not matter

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I think http://bugs.python.org/issue12776, which delays type conversions on defaults should solve this problem, right? If you agree, could you add your code here as a test case to that issue and mark this as duplicate? (And yes, I

[issue13041] argparse: terminal width is not detected properly

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I'd feel more comfortable with the argparse fix if it were simply calling os.get_terminal_size(). I recommend that you: * Create a new issue called, say add os.get_terminal_size() proposing just the single method. * Add that issue

[issue12806] argparse: Hybrid help text formatter

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: As I understand it the current proposal is: * Wrap each paragraph separately * Don't wrap any lines indented by at least one additional space This sounds like a useful formatter. I would probably call it PargraphWrappingFormatter

[issue9253] argparse: optional subparsers

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: If you can make your patch relative to the cpython source tree, and add a couple tests, it will be easier to review. Thanks for working on this! -- ___ Python tracker rep...@bugs.python.org

[issue13023] argparse should allow displaying argument default values in addition to setting a formatter class

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Your solution is actually the current recommended solution - mix together both classes that you want to combine and pass your subclass as the parameter. This should probably be documented somewhere (and tested more

[issue12713] argparse: allow abbreviation of sub commands by users

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Modulo the comments already on the patch by others, this approach looks fine to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12713

[issue12686] argparse - document (and improve?) use of SUPPRESS with help=

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Could you give some examples of bugs that you observed? Otherwise, this looks like a duplicate of issue 9349. The intention is that help=SUPPRESS should cause the given argument to not be displayed in the help message

[issue11708] argparse: suggestion for formatting optional positional args

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I agree that this is a bug in current argparse formatting. It might be a little difficult to fix though because the current option formatting handles arguments one at a time, and producing something like [arg1 [arg2]] requires some

[issue12284] argparse.ArgumentParser: usage example option

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: %(prog)s is available in epilog: -- temp.py -- import argparse epilog = \ Example usage: %(prog)s option1 option2 parser = argparse.ArgumentParser( formatter_class=argparse.RawTextHelpFormatter, epilog=epilog

[issue9938] Documentation for argparse interactive use

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: Looks good to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9938 ___ ___ Python

[issue11839] argparse: unexpected behavior of default for FileType('w')

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I think Issue 12776, which delays type conversions on defaults, should solve this problem, right? If you agree, could you add your code here as a test case to that issue and mark this as duplicate

[issue11874] argparse assertion failure with brackets in metavars

2011-12-15 Thread Steven Bethard
Steven Bethard steven.beth...@gmail.com added the comment: I agree this is a bug. The patch needs to add unit tests that make sure metavars with [] work as expected. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11874

  1   2   3   4   5   6   7   8   9   10   >