[issue13540] Document the Action API in argparse

2011-12-15 Thread Steven Bethard
Steven Bethard 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 be a callable that accepts at

[issue13584] argparse doesn't respect double quotes

2011-12-15 Thread Steven Bethard
Steven Bethard 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.ad

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

2011-12-15 Thread Steven Bethard
Steven Bethard 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 in _get_values,

[issue10772] Several actions for argparse arguments missing from docs

2011-12-15 Thread Steven Bethard
Steven Bethard added the comment: Looks good to me too. -- ___ Python tracker <http://bugs.python.org/issue10772> ___ ___ Python-bugs-list mailing list Unsub

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

2011-12-15 Thread Steven Bethard
Steven Bethard 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 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 agree this is a bug

[issue13041] argparse: terminal width is not detected properly

2011-12-15 Thread Steven Bethard
Steven Bethard 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 iss

[issue12806] argparse: Hybrid help text formatter

2011-12-15 Thread Steven Bethard
Steven Bethard 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" or some

[issue9253] argparse: optional subparsers

2011-12-15 Thread Steven Bethard
Steven Bethard 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 <http://bugs.python.org/issue9

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

2011-12-15 Thread Steven Bethard
Steven Bethard 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 added the comment: Modulo the comments already on the patch by others, this approach looks fine to me. -- ___ Python tracker <http://bugs.python.org/issue12

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

2011-12-15 Thread Steven Bethard
Steven Bethard 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. If there are cases where that'

[issue11708] argparse: suggestion for formatting optional positional args

2011-12-15 Thread Steven Bethard
Steven Bethard 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 understanding of how

[issue12284] argparse.ArgumentParser: usage example option

2011-12-15 Thread Steven Bethard
Steven Bethard 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.RawTextHe

[issue9938] Documentation for argparse interactive use

2011-12-15 Thread Steven Bethard
Steven Bethard added the comment: Looks good to me. -- ___ Python tracker <http://bugs.python.org/issue9938> ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2011-12-15 Thread Steven Bethard
Steven Bethard 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? -- ___ Python

[issue11874] argparse assertion failure with brackets in metavars

2011-12-15 Thread Steven Bethard
Steven Bethard 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 <http://bugs.python.org/issue11

[issue11807] Documentation of add_subparsers lacks information about parametres

2011-12-15 Thread Steven Bethard
Steven Bethard added the comment: Looks good. A few minor comments (click "review" by the patch). -- ___ Python tracker <http://bugs.python.o

[issue13605] document argparse's nargs=REMAINDER

2011-12-15 Thread Steven Bethard
New submission from Steven Bethard : There is an undocumented value for add_argument's nargs parameter, REMAINDER, which can be used to consume all the remaining arguments. This is commonly useful for command line utilities that dispatch to other command line utilities. Though undocum

[issue13584] argparse doesn't respect double quotes

2011-12-16 Thread Steven Bethard
Steven Bethard added the comment: Closing then. Thanks for checking it again! -- assignee: -> bethard resolution: -> works for me stage: -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python

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

2012-01-10 Thread Steven Bethard
Steven Bethard added the comment: Eric's suggested doc fix looks good to me. -- ___ Python tracker <http://bugs.python.org/issue13685> ___ ___ Python-bugs-l

[issue9571] argparse: Allow the use of -- to break out of nargs and into subparser

2010-08-12 Thread Steven Bethard
Steven Bethard added the comment: This is closely related to issue 9338. The parser should know that your command line requires at least the COMMAND argument, so it should stop parsing in time for that. However, in the case of subcommands, even if we solved issue 9338, you would still get

[issue9625] argparse: Problem with defaults for variable nargs

2010-08-17 Thread Steven Bethard
Changes by Steven Bethard : -- nosy: +bethard stage: -> needs patch versions: +Python 2.7, Python 3.2 -Python 2.6 ___ Python tracker <http://bugs.python.org/iss

[issue9653] New default argparse output to be added

2010-08-22 Thread Steven Bethard
Steven Bethard added the comment: A simpler approach might be to do this before your call to parse_args: if len(sys.argv[0]) == 1: parser.print_help() Does that solve your problem? -- ___ Python tracker <http://bugs.python.org/issue9

[issue9653] New default argparse output to be added

2010-08-22 Thread Steven Bethard
Steven Bethard added the comment: Sorry, typo. Should have been len(sys.argv) == 1. Full script: import argparse import sys parser = argparse.ArgumentParser() parser.add_argument('--foo') if len(sys.argv) == 1: parser.print_help() else: print(parser.parse_args()) With t

[issue9653] New default argparse output to be added

2010-08-24 Thread Steven Bethard
Steven Bethard added the comment: I see. When there are no arguments you basically want to replace the standard argparse help entirely with your own message, with your own capitalization, etc. What you're doing now looks like a pretty good approach for this, so I guess I'm still

[issue9694] argparse: Default Help Message Lists Required Args As Optional

2010-08-26 Thread Steven Bethard
Steven Bethard added the comment: Yeah, I guess the optional vs. positional isn't the best terminology now that you can have required flag-based arguments. Did you have a word other than "optional" that you'd prefer? -- ___ P

[issue9694] argparse: Default Help Message Lists Required Args As Optional

2010-08-27 Thread Steven Bethard
Steven Bethard added the comment: I guess one possibility might be "flag arguments". It's not great, but I guess it's more accurate. -- ___ Python tracker <http://bu

[issue9694] argparse: Default Help Message Lists Required Args As Optional

2010-08-27 Thread Steven Bethard
Steven Bethard added the comment: And I guess the bigger issue to think about is how to add this in a backwards compatible way. I guess we could just add methods like "set_positionals_group_name(name)" and then fiddle with "self._positionals.title" in there. Not sure tha

[issue9652] Tidy argparse default output

2010-08-27 Thread Steven Bethard
Steven Bethard added the comment: Looks like "usage" is almost always lowercase in the programs I tried (ssh, svn, cat, etc.). So it probably wouldn't be a good idea to change the default. Seems like both this and issue 9694 need a better way to customize the text in argparse

[issue9694] argparse: Default Help Message Lists Required Args As Optional

2010-08-28 Thread Steven Bethard
Steven Bethard added the comment: I think this is still really a feature request. We can't just change the text from "optional" - that would silently change a large number of help messages without any warning. So to fix this "bug", we're going to have to add

[issue9779] argparse.ArgumentParser not support unicode in print help

2010-09-13 Thread Steven Bethard
Steven Bethard added the comment: Are you sure this is an argparse issue, and not a terminal issue? Here's what I see: >>> parser = argparse.ArgumentParser(description=u'Rus Рус') >>> print(parser.description) Rus Рус >>> sys.stderr.write(parser.des

[issue9938] Documentation for argparse interactive use

2010-09-24 Thread Steven Bethard
Changes by Steven Bethard : -- nosy: +bethard versions: +Python 3.2 ___ Python tracker <http://bugs.python.org/issue9938> ___ ___ Python-bugs-list mailin

[issue5936] Add MSI suport for uninstalling individual versions

2010-10-22 Thread Steven Bethard
Steven Bethard added the comment: > Would you have to do this for every installed distribution? > Seems cumbersome. Well, the feature not being implemented yet, it's hard to tell what it would do. ;-) But I think the simplest approach would actually yield a dialog where you simpl

[issue10190] Can argparse._AttributeHolder._get_kwargs become a public API?

2010-10-25 Thread Steven Bethard
Steven Bethard added the comment: Could you elaborate a little on what you use it for? The argparse module only uses this for pretty __repr__ on the various objects. (And in fact, it looks like it's gotten a little out of sync - "required" is missing from Action, and a numbe

[issue9553] test_argparse.py: 80 failures if COLUMNS env var set to a value other than 80

2010-11-01 Thread Steven Bethard
Steven Bethard added the comment: Fixed with a variant of Denver's last patch in r86080 for 3.X and r86083 for 2.7. -- assignee: -> bethard resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.pyt

[issue9353] argparse __all__ is incomplete

2010-11-01 Thread Steven Bethard
Steven Bethard added the comment: Fixed in 3.X in r86086 and in 2.7 in r86087. -- assignee: -> bethard resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.o

[issue4640] optparse doesn’t disallow adding one-da sh long options (“-option”)

2010-11-01 Thread Steven Bethard
Changes by Steven Bethard : -- nosy: -bethard ___ Python tracker <http://bugs.python.org/issue4640> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue9352] argparse eats characters when parsing multiple merged short options

2010-11-01 Thread Steven Bethard
Steven Bethard added the comment: Patches applied in r86090 (3.X) and r86091 (2.7). Thanks for your help Catherine, and sorry it took me so long to apply these. -- assignee: -> bethard resolution: -> fixed status: open -> closed _

[issue9355] argparse add_mutually_exclusive_group more than once has incorrectly formatted help

2010-11-01 Thread Steven Bethard
Steven Bethard added the comment: Committed in r86092 (3.X) and r86093 (2.7). Thanks for the patches! -- assignee: -> bethard resolution: -> fixed status: open -> closed ___ Python tracker <http://bugs.python.o

[issue9779] argparse.ArgumentParser not support unicode in print help

2010-11-01 Thread Steven Bethard
Steven Bethard added the comment: Closing as invalid, as to me this looks like a classic terminal encoding issue and not an argparse issue, and there was no response from the user who filed the issue. If someone still thinks this is an argparse issue, please provide a test and reopen the

[issue9340] argparse parse_known_args does not work with subparsers

2010-11-02 Thread Steven Bethard
Steven Bethard added the comment: Fixed with a variant of Catherine's patch (following R. David Murray's suggestion of inlining the two methods) in r86111 (3.X) and r86112 (2.7). Also added one more test to make sure that the order of the extra arguments is consistent (extra argu

[issue2931] optparse: various problems with unicode and gettext

2010-11-06 Thread Steven Bethard
Steven Bethard added the comment: Yep, argparse almost certainly has the same kind of problems - I basically copied the optparse gettext behavior into argparse because I don't really know how that stuff works but figured people must have wanted what was in

[issue10423] s/args/options in arpgarse "Upgrading optparse code"

2010-11-15 Thread Steven Bethard
New submission from Steven Bethard : >From a personal email: -- I'm not signed up for all the Python issue tracking stuff, but thought I'd let you know about a problem with the argparse doc page: http://do

[issue10424] better error message from argparse when positionals missing

2010-11-15 Thread Steven Bethard
New submission from Steven Bethard : >From a private email in respect to the following class of error messages: >>> parser = argparse.ArgumentParser(prog='PROG') >>> parser.add_argument('--foo') >>> parser.add_argument('--bar')

[issue9253] argparse: optional subparsers

2010-11-16 Thread Steven Bethard
Steven Bethard added the comment: I think the proposed API looks fine and should be backwards compatible since add_subparsers will currently throw an exception with a default= argument. In case someone feels like writing a patch, you'll want to look at _SubParsersAction.__init__, which

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

2011-03-26 Thread Steven Bethard
Steven Bethard added the comment: Thanks for the analysis Eric. Yeah, it does seem like it's not possible to implement this feature request while still supporting optionals with variable number arguments. @andersk: Would the restriction to only having flags with a fixed number of argu

[issue7284] argparse - display version in usage by default

2011-03-26 Thread Steven Bethard
Steven Bethard added the comment: In argparse, you could so something like: version = "2.7" parser = argparse.ArgumentParser( description="My program XXX, version " + version) parser.add_argument('-v', action='version', version=version) That would

[issue11174] add argparse formatting option to display type names for metavar

2011-03-26 Thread Steven Bethard
Steven Bethard added the comment: Sorry about such a slow response on this. Thanks for the patch! I think rather than adding an ArgumentParser constructor parameter though, we should add a new formatter class. The attached patch allows you to write: >>> parser = argparse.Argum

[issue7284] argparse - display version in usage by default

2011-03-26 Thread Steven Bethard
Steven Bethard added the comment: I'm not sure about the usage_template approach - seems like it might be hard to make it work, while still supporting formatter_class. (Though maybe it's not so bad since the formatter class methods are all considered implementation details.) I

[issue11174] add argparse formatting option to display type names for metavar

2011-03-26 Thread Steven Bethard
Changes by Steven Bethard : -- assignee: -> bethard resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python

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

2011-03-26 Thread Steven Bethard
Steven Bethard added the comment: Thanks for the patch. The idea and the approach of the patch look fine. But the patch needs to be against the Python repository: http://docs.python.org/devguide/patch.html#creating For the tests, you should integrate your test.py into Lib/test

[issue11588] Add "necessarily inclusive" groups to argparse

2011-03-26 Thread Steven Bethard
Steven Bethard added the comment: I think this is a great suggestion. Care to work on a patch? -- stage: -> needs patch ___ Python tracker <http://bugs.python.org/issu

[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)

2011-03-26 Thread Steven Bethard
Changes by Steven Bethard : -- stage: patch review -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.org/issue10680> ___ __

[issue9348] Calling argparse's add_argument with the wrong number of metavars causes delayed error message

2011-03-26 Thread Steven Bethard
Steven Bethard added the comment: Thanks for the patch. I used something similar to what you proposed, but instead of creating a local formatter, I just call self._get_formatter() if it exists. -- assignee: -> bethard nosy: -python-dev resolution: -> fixed stage: needs

[issue8982] argparse docs cross reference Namespace as a class but the Namespace class is not documented

2011-03-26 Thread Steven Bethard
Steven Bethard added the comment: I fixed the docs here so that they're clearer about what the Namespace object is, and also so that they mention the `vars` approach if you want dict-style access. -- resolution: -> fixed stage: needs patch -> committed/rejected s

[issue9343] Document that argparse "parents" must be fully declared before children

2011-03-26 Thread Steven Bethard
Steven Bethard added the comment: I added some documentation in the "parents" section of the argparse docs. -- assignee: docs@python -> bethard resolution: -> fixed stage: -> committed/rejected status: open -> closed ___

[issue9026] argparse subcommands not printed in the same order they were added

2011-03-27 Thread Steven Bethard
Steven Bethard added the comment: Sorry for letting this bug sit around for so long. I committed a slight variant of your patch to 2.7, 3.2 and 3.3. Thanks! -- resolution: -> fixed stage: patch review -> committed/rejected status: open -> closed versions: +P

[issue1446619] extended slice behavior inconsistent with docs

2011-03-27 Thread Steven Bethard
Steven Bethard added the comment: The problem still exists in current trunk: The slicing semantics have been removed from the expressions reference: http://docs.python.org/py3k/reference/expressions.html#slicings The datamodel and types sections still have the same equations: http

[issue1446619] extended slice behavior inconsistent with docs

2011-03-27 Thread Steven Bethard
Changes by Steven Bethard : -- stage: test needed -> patch review ___ Python tracker <http://bugs.python.org/issue1446619> ___ ___ Python-bugs-list mai

[issue11695] Improve argparse usage/help customization

2011-03-27 Thread Steven Bethard
New submission from Steven Bethard : I'm going to try to merge several closely related issues here. Basically, people would like better control over the usage message formatting so that you could: * Put program name and version information at the top of the message * Customize the &

[issue7284] argparse - display version in usage by default

2011-03-27 Thread Steven Bethard
Steven Bethard added the comment: I'm moving this over to Issue 11695, which proposes support for a usage/help message template. -- resolution: -> duplicate stage: -> committed/rejected status: open -> closed superseder: -> Improve argparse usage/h

[issue9652] Enhance argparse help output customizability

2011-03-27 Thread Steven Bethard
Steven Bethard added the comment: I'm moving this over to Issue 11695, which proposes support for a usage/help message template. To customize the argument group names, the recommended approach is to create your own argument groups, and only put arguments there, e.g.: p

[issue9694] argparse: Default Help Message Lists Required Args As Optional

2011-03-27 Thread Steven Bethard
Steven Bethard added the comment: So it strikes me that there already exists an officially supported way to rename your option groups. Just only create your own option groups (never use the default ones) and only put arguments there, e.g.: - temp.py

[issue9653] New default argparse output to be added

2011-03-27 Thread Steven Bethard
Steven Bethard added the comment: I'm moving this over to Issue 11695, which proposes support for a usage/help message template. -- resolution: -> duplicate stage: -> committed/rejected status: open -> closed superseder: -> Improve argparse usage/h

[issue9347] Calling argparse add_argument with a sequence as 'type' causes spurious error message

2011-04-03 Thread Steven Bethard
Changes by Steven Bethard : -- assignee: -> bethard resolution: -> fixed stage: needs patch -> committed/rejected status: open -> closed versions: +Python 3.3 ___ Python tracker <http://bugs.pytho

[issue9182] document “--” as a way to disti nguish option w/ narg='+' from positional argument in arg parse

2010-11-19 Thread Steven Bethard
Steven Bethard added the comment: The original point is basically a duplicate of issue 9338. It is undesirable behavior, I just don't know how to fix it. Patches to fix it are welcome (on issue 9338). ;-) As to documenting '--', I agree it's hidden too far down

[issue10424] better error message from argparse when positionals missing

2010-11-19 Thread Steven Bethard
Steven Bethard added the comment: No, it's exactly line 1925 that's the problem. The OP would like that to tell him which arguments were missing instead of saying just 'too few arguments'. The block below that is for checking required optionals/positionals. It won't

[issue10424] better error message from argparse when positionals missing

2010-11-20 Thread Steven Bethard
Steven Bethard added the comment: Yeah a new test class is fine. And I checked the patch and it looks okay to me. My first thought was also "wait does that really work?" but I see that positionals are all marked as required when appropriate (look for the comment starting

[issue9182] document “--” as a way to disti nguish option w/ narg='+' from positional argument in arg parse

2010-11-20 Thread Steven Bethard
Steven Bethard added the comment: Sorry, I think I confused you, please post that patch here. This issue is for documenting the workarounds, issue 9338 is for actually solving the problem. I glanced at your patch on that issue, and it looks basically okay, though I'd like to see a few

[issue9182] document “--” as a way to disti nguish option w/ narg='+' from positional argument in arg parse

2010-11-21 Thread Steven Bethard
Steven Bethard added the comment: Yeah, sorry, those last two should have had arguments after them. I think we have to stick with the current behavior - otherwise there's no way to do something like -x -A -B, where you want -A and -B to be arguments to -x. (You can get that now with -x

[issue9509] argparse FileType raises ugly exception for missing file

2010-11-24 Thread Steven Bethard
Steven Bethard added the comment: I'm not sure about the patch - this will convert *all* IOErrors into command line error messages, while we should really only be converting the ones raised by FileType. Instead, the try/except should be in FileType.__call__, and you should rai

[issue10497] Incorrect use of gettext in argparse

2010-11-24 Thread Steven Bethard
Steven Bethard added the comment: Looks like a great fix. And yes, anyone who knows anything about gettext, please feel free to add a test or ten. ;-) I just copied optparse when I put that stuff in, so I have no confidence in how it's don

[issue10528] argparse uses %s in gettext calls

2010-11-25 Thread Steven Bethard
Steven Bethard added the comment: I think it's fine to fix this in 3.2 by switching to mappings where necessary. -- ___ Python tracker <http://bugs.python.org/is

[issue9509] argparse FileType raises ugly exception for missing file

2010-11-27 Thread Steven Bethard
Steven Bethard added the comment: Tried to comment in Rietveld but it didn't work for some reason. Anyway, I think the argparse.py patch isn't good - changing the type error message to "'invalid %s value: %r details: "%s"'" will change the behavi

[issue9509] argparse FileType raises ugly exception for missing file

2010-11-27 Thread Steven Bethard
Steven Bethard added the comment: Sorry, I was looking at the akira patch with the same date, where I was mainly worried about the modification of the "except (TypeError, ValueError):" block. Your patch doesn't do that,

[issue6454] Add "example" keyword argument to optparse constructor

2010-11-28 Thread Steven Bethard
Steven Bethard added the comment: With argparse, you can specify formatter_class= RawDescriptionHelpFormatter and then format things however you want in the description. http://docs.python.org/dev/library/argparse.html#formatter-class So I think there's no need for this in arg

[issue10528] argparse uses %s in gettext calls

2010-12-03 Thread Steven Bethard
Steven Bethard added the comment: If I understand it right, before this patch, people couldn't really supply internationalizations for these calls - they would have had to have a translation for each possible value of, e.g. action.choices or parser.prefix_chars. So I think there

[issue10528] argparse uses %s in gettext calls

2010-12-03 Thread Steven Bethard
Steven Bethard added the comment: Hmm. I see I confused this with Issue 10529, where there really was a bug in the gettext calls. Nonetheless, +1 for switching from %s to %(xxx)s in 3.2 - since that's the first release in Python 3 that has argparse, I think it's really okay

[issue10497] Incorrect use of gettext in argparse

2010-12-03 Thread Steven Bethard
Steven Bethard added the comment: Yes, I think it's okay to fix this without a test, given that it's a nontrivial amount of work to test gettext stuff. I'd rather have it working now, without tests, than wait until we know how to test stuff with gettext. It's also a prett

[issue4391] use proper gettext plurals forms in argparse and optparse

2010-12-05 Thread Steven Bethard
Steven Bethard added the comment: The workaround in TestImportStar is fine. The test is really just meant to make sure that __all__ contains all the current API methods, and the "_" checks were the easiest way at the time to

[issue9234] argparse: aliases for positional arguments (subparsers)

2010-12-17 Thread Steven Bethard
Steven Bethard added the comment: The patch looks basically okay to me, though this line makes me nervous: dest += ' (%s)' % ', '.join(aliases) Since this is just for help formatting, can't you just modify metavar instead? The dest is the attribute on the namespac

[issue9938] Documentation for argparse interactive use

2010-12-17 Thread Steven Bethard
Steven Bethard added the comment: In the short term, just catch the SystemExit. In the slightly longer term, we could certainly provide a subclass, say, ErrorRaisingArgumentParser, that overrides .exit and .error to do nothing but raise an exception with the message they would have printed

[issue9234] argparse: aliases for positional arguments (subparsers)

2010-12-18 Thread Steven Bethard
Steven Bethard added the comment: Looks good to me. -- ___ Python tracker <http://bugs.python.org/issue9234> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue10728] argparse.ArgumentParser.print_help uses sys.stdout

2010-12-18 Thread Steven Bethard
Steven Bethard added the comment: Yep, this is a documentation bug. Help is definitely intended to print to stdout. -- versions: -Python 3.1 ___ Python tracker <http://bugs.python.org/issue10

[issue9234] argparse: aliases for positional arguments (subparsers)

2010-12-18 Thread Steven Bethard
Steven Bethard added the comment: Applied in r87362. -- resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker <http://bugs.python.o

[issue9355] argparse add_mutually_exclusive_group more than once has incorrectly formatted help

2010-12-21 Thread Steven Bethard
Changes by Steven Bethard : -- stage: needs patch -> committed/rejected ___ Python tracker <http://bugs.python.org/issue9355> ___ ___ Python-bugs-list mai

[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)

2010-12-21 Thread Steven Bethard
Steven Bethard added the comment: Yep, I believe that fix should work. Now to find the time to write some tests... -- nosy: +bethard stage: -> unit test needed versions: -Python 3.1 ___ Python tracker <http://bugs.python.org/issu

[issue10772] Several actions for argparse arguments missing from docs

2011-01-02 Thread Steven Bethard
Steven Bethard added the comment: action="help" definitely needs to be documented action="count" probably should be, though I think it's pretty useless (I just copied it from optparse) action="parsers", nargs="..." and nargs="A...&qu

[issue10984] argparse add_mutually_exclusive_group should accept existing arguments to register conflicts

2011-01-23 Thread Steven Bethard
Steven Bethard added the comment: I'm definitely open to providing such functionality. I assume you're imagining something like: parser = argparse.ArgumentParser() a_action = parser.add_argument('-a') b_action = parser.add_argument('-b') c_action = pars

[issue9509] argparse FileType raises ugly exception for missing file

2011-01-23 Thread Steven Bethard
Steven Bethard added the comment: Georg, is this something we can patch for rc2? It's a bug - errors encountered by argparse-internal code should be translated into command line errors, and they currently aren't for read-only files. For what it's worth, the tests fa

[issue9509] argparse FileType raises ugly exception for missing file

2011-01-23 Thread Steven Bethard
Steven Bethard added the comment: Good point. Here's the updated patch that reports the IOError as well. All tests pass. I'll apply in a bit if I don't hear otherwise. -- Added file: http://bugs.python.org/file20491/argparse.diff ___

[issue9509] argparse FileType raises ugly exception for missing file

2011-01-23 Thread Steven Bethard
Steven Bethard added the comment: The docs for os.chmod claim: Availability: Unix, Windows. Although Windows supports chmod(), you can only set the file's read-only flag with it (via the stat.S_IWRITE and stat.S_IREAD constants or a corresponding integer value). All other bits are ig

[issue9509] argparse FileType raises ugly exception for missing file

2011-01-24 Thread Steven Bethard
Steven Bethard added the comment: Fixed in r88169 and r88171. Thanks everyone for your help! I'll be keeping my eye on the buildbots for a bit to make sure everything stays green. -- assignee: -> bethard resolution: -> fixed stage: patch review -> committed/r

[issue9509] argparse FileType raises ugly exception for missing file

2011-01-25 Thread Steven Bethard
Steven Bethard added the comment: It's an ArgumentTypeError because that's what you're supposed to raise inside type functions: http://docs.python.org/dev/library/argparse.html#type (Note that argparse.FileType.__call__ is what will be called when we pass type=argparse.F

[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)

2011-01-30 Thread Steven Bethard
Steven Bethard added the comment: Looks great, thanks. I've updated the patch so it applies okay to both release27-maint and py3k. All tests pass on both branches. It's a one line fix and the test case looks good, so there should be no problem applying this to release27-maint. Fo

[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)

2011-01-30 Thread Steven Bethard
Changes by Steven Bethard : Removed file: http://bugs.python.org/file20548/issue10680_withTestcase.patch ___ Python tracker <http://bugs.python.org/issue10680> ___ ___

[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)

2011-01-30 Thread Steven Bethard
Changes by Steven Bethard : Removed file: http://bugs.python.org/file20114/argparse.diff ___ Python tracker <http://bugs.python.org/issue10680> ___ ___ Python-bugs-list m

[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)

2011-01-30 Thread Steven Bethard
Steven Bethard added the comment: Awesome, thanks! Do you want to apply to 2.7 or should I? -- ___ Python tracker <http://bugs.python.org/issue10680> ___ ___

[issue10680] argparse: titles and add_mutually_exclusive_group don't mix (even with workaround)

2011-01-30 Thread Steven Bethard
Steven Bethard added the comment: Done in r88268. Thanks again everyone! -- ___ Python tracker <http://bugs.python.org/issue10680> ___ ___ Python-bugs-list mailin

  1   2   3   4   >