Message186695
| Author |
paul.j3 |
| Recipients |
DasIch, G2P, Julian, bethard, bewest, bkabrda, chris.jerdonek, csernazs, dsully, elsdoerfer, eric.araujo, labrat, nvie, paul.j3, r.david.murray, seblu, zzzeek |
| Date |
2013年04月13日.06:24:31 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1365834273.12.0.564979203879.issue9253@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
This patch addresses both issues raised here:
- throw an error when the subparser argument is missing
- allow the subparser argument to be optional
argparse.py:
_SubParsersAction -
add 'required=True' keyword.
name(self) method - creates a name of the form {cmd1,cmd2} for error messages.
_get_action_name() - try action.name() if it can't get a name from option_strings, dest or metavar. Still can return None.
2 error cases do a join on a list of action_names. If a name is None, this will choke. Add a ['%s'%x for x in list] guard.
test_argparse.py:
add cases to the subparser block to test the 'required' keyword, and to test the error message changes.
argparse.rst:
add a summary of the add_subparsers() arguments. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2013年04月13日 06:24:33 | paul.j3 | set | recipients:
+ paul.j3, csernazs, bethard, eric.araujo, r.david.murray, zzzeek, labrat, chris.jerdonek, nvie, DasIch, elsdoerfer, G2P, Julian, dsully, seblu, bewest, bkabrda |
| 2013年04月13日 06:24:33 | paul.j3 | set | messageid: <1365834273.12.0.564979203879.issue9253@psf.upfronthosting.co.za> |
| 2013年04月13日 06:24:33 | paul.j3 | link | issue9253 messages |
| 2013年04月13日 06:24:32 | paul.j3 | create |
|