This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年05月25日 10:59 by jens.jaehrig, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| disable-abbrev.patch | jpaugh, 2012年05月26日 20:26 | Patch wi/tests,doc | review | |
| 14910.patch | bethard, 2012年07月22日 19:57 | review | ||
| issue14910_2.patch | paul.j3, 2014年05月09日 04:36 | review | ||
| issue_14910_3.diff | puppet, 2014年08月02日 12:27 | review | ||
| issue14910_4.diff | puppet, 2014年08月03日 08:01 | review | ||
| issue14910_5.diff | puppet, 2014年08月03日 08:06 | review | ||
| issue14910_6.diff | puppet, 2014年08月04日 08:23 | review | ||
| issue14910_7.diff.txt | puppet, 2014年08月04日 20:54 | review | ||
| Messages (24) | |||
|---|---|---|---|
| msg161566 - (view) | Author: Jens Jährig (jens.jaehrig) | Date: 2012年05月25日 11:02 | |
argparse uses per default abbreviation in unambiguous cases. I don't want abbreviation and i'd like to disable it. But theres no option to do this. http://docs.python.org/library/argparse.html#argument-abbreviations Only to override the Handler like suggested here: http://stackoverflow.com/questions/10750802/python-argparse-disable-abbreviation/10751356#10751356 ################ # Example # ################ import argparse parser = argparse.ArgumentParser() parser.add_argument('--send', action='store_true') parser.parse_args(['--se']) # returns Namespace(send=True) But i want it only to be true when the full parameter is supplied. To prevent user errors. |
|||
| msg161672 - (view) | Author: Jonathan Paugh (jpaugh) | Date: 2012年05月26日 17:54 | |
I am dubious as to the use of this: I think resolving partial args is one of the best thing since invented since sliced bread. However, it's a good project to get my feet wet, so I'll take it on. I should have a patch later today--I'm working on test-cases just now. |
|||
| msg161680 - (view) | Author: Jonathan Paugh (jpaugh) | Date: 2012年05月26日 20:26 | |
I created a patch that exibhts the requested behavior. I added tests, and updated the documentation. I ran the test-suite against a build of Python 3.3.0a3+, and all tests check out. This changes the public API of argparse.ArgumentParser and of its parse_args() method. |
|||
| msg166160 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2012年07月22日 19:57 | |
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, and I fixed that and uploaded a new patch. To be complete, the patch also needs to add some documentation, edit Misc/NEWS, etc. See: http://docs.python.org/devguide/patch.html#preparation |
|||
| msg166161 - (view) | Author: Steven Bethard (bethard) * (Python committer) | Date: 2012年07月22日 19:58 | |
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! |
|||
| msg166162 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年07月22日 20:06 | |
Jonathan: we are in feature freeze right now preparing 3.3 for release, so you might want to ping the issue once 3.3 is out to remind us to do the checkin. |
|||
| msg187235 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2013年04月18日 10:24 | |
Ping :) |
|||
| msg204678 - (view) | Author: paul j3 (paul.j3) * (Python triager) | Date: 2013年11月28日 17:15 | |
For a programmer who needs to turn off this abbreviation matching now, a simple solution is to subclass ArgumentParser: class MyParser(ArgumentParser): def _get_option_tuples(self, option_string): return [] This could be the place to implement more specialized matching (e.g. do not match on strings like '--sync'). |
|||
| msg218137 - (view) | Author: paul j3 (paul.j3) * (Python triager) | Date: 2014年05月09日 03:19 | |
Update the patch - test_argparse.py - cleanup spaces argparse.rst - merging conflicts |
|||
| msg224557 - (view) | Author: Daniel Eriksson (puppet) * | Date: 2014年08月02日 12:27 | |
Update the patch - issue_14910_3.diff argparse.rst - merging conflicts |
|||
| msg224567 - (view) | Author: Eli Bendersky (eli.bendersky) * (Python committer) | Date: 2014年08月02日 13:47 | |
Daniel, I left some comments in Rietveld. Also it doesn't seem that you addressed the previously left comments when you fixed up the patch. |
|||
| msg224616 - (view) | Author: Daniel Eriksson (puppet) * | Date: 2014年08月03日 08:01 | |
Oh, completely missed comments there too! I hope I got them all in a good way! |
|||
| msg224617 - (view) | Author: Daniel Eriksson (puppet) * | Date: 2014年08月03日 08:06 | |
Sorry for a new patch this close, but just tripple checked the documentation and noticed a word to much. Made it more clear hopefully |
|||
| msg224629 - (view) | Author: Eli Bendersky (eli.bendersky) * (Python committer) | Date: 2014年08月03日 12:46 | |
No worries, Daniel. You should have received an email when comments were posted to the review, did you? If you you may want to check your settings in the bug tracker. I left a couple of additional comments on the documentation file, but other than that this LGTM. |
|||
| msg224654 - (view) | Author: Daniel Eriksson (puppet) * | Date: 2014年08月03日 20:12 | |
Eli, will look into those tomorrow morning, so a final patch will come during tomorrow. Checked my spam folder - and there they where, fixed the settings now so I get it faster. |
|||
| msg224699 - (view) | Author: Daniel Eriksson (puppet) * | Date: 2014年08月04日 08:23 | |
Fixed documentation issues |
|||
| msg224775 - (view) | Author: Daniel Eriksson (puppet) * | Date: 2014年08月04日 20:54 | |
Updated patch |
|||
| msg225009 - (view) | Author: Eli Bendersky (eli.bendersky) * (Python committer) | Date: 2014年08月07日 13:00 | |
Ezio, could you see if your comments were addressed? Steven, do you want to take another look, or is this OK to commit? |
|||
| msg234476 - (view) | Author: Andy Zobro (xobes) | Date: 2015年01月22日 06:05 | |
This breaks custom actions. e.g.: class dict_action(argparse.Action): def __init__(self, *a, **k): argparse.Action.__init__(self, *a, **k) TypeError: __init__() got an unexpected keyword argument 'allow_abbrev' |
|||
| msg234477 - (view) | Author: Andy Zobro (xobes) | Date: 2015年01月22日 06:12 | |
Ignore previous comment, I wish I could delete it. I simply provided the allow_abbrev to the wrong function and spent zero time investigating the error. |
|||
| msg235362 - (view) | Author: Rémi Rampin (remram) * | Date: 2015年02月03日 21:03 | |
It looks like the previous comments were addressed in the latest patch. Is this still planned for 3.5? Alpha 1 is next week according to PEP478. |
|||
| msg235421 - (view) | Author: Berker Peksag (berker.peksag) * (Python committer) | Date: 2015年02月05日 07:27 | |
The patch LGTM. In Doc/library/argparse.rst: - add_help=True) + allow_abbrev=True, add_help=True) should be add_help=True, allow_abbrev=True) I'll add a release note and commit it. Thanks! |
|||
| msg235926 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2015年02月13日 23:39 | |
New changeset 99302634d756 by Berker Peksag in branch 'default': Issue #14910: Add allow_abbrev parameter to argparse.ArgumentParser. https://hg.python.org/cpython/rev/99302634d756 |
|||
| msg235928 - (view) | Author: Berker Peksag (berker.peksag) * (Python committer) | Date: 2015年02月13日 23:41 | |
Committed. Thank you all for patches and reviews :) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:30 | admin | set | github: 59115 |
| 2015年02月13日 23:41:44 | berker.peksag | set | status: open -> closed resolution: fixed messages: + msg235928 stage: patch review -> resolved |
| 2015年02月13日 23:39:01 | python-dev | set | nosy:
+ python-dev messages: + msg235926 |
| 2015年02月05日 07:27:02 | berker.peksag | set | assignee: berker.peksag messages: + msg235421 nosy: + berker.peksag |
| 2015年02月03日 21:03:03 | remram | set | messages: + msg235362 |
| 2015年01月26日 14:08:01 | remram | set | nosy:
+ remram |
| 2015年01月22日 06:12:42 | xobes | set | messages: + msg234477 |
| 2015年01月22日 06:05:56 | xobes | set | nosy:
+ xobes messages: + msg234476 |
| 2014年08月07日 13:00:43 | eli.bendersky | set | messages: + msg225009 |
| 2014年08月04日 20:54:42 | puppet | set | files:
+ issue14910_7.diff.txt messages: + msg224775 |
| 2014年08月04日 08:23:02 | puppet | set | files:
+ issue14910_6.diff messages: + msg224699 |
| 2014年08月04日 01:28:23 | berker.peksag | set | components:
+ Library (Lib), - None stage: patch review |
| 2014年08月03日 20:12:24 | puppet | set | messages: + msg224654 |
| 2014年08月03日 12:46:52 | eli.bendersky | set | messages: + msg224629 |
| 2014年08月03日 08:06:00 | puppet | set | files:
+ issue14910_5.diff messages: + msg224617 |
| 2014年08月03日 08:01:36 | puppet | set | files:
+ issue14910_4.diff messages: + msg224616 |
| 2014年08月02日 13:47:34 | eli.bendersky | set | messages: + msg224567 |
| 2014年08月02日 12:27:52 | puppet | set | files:
+ issue_14910_3.diff nosy: + puppet messages: + msg224557 |
| 2014年05月09日 04:36:19 | paul.j3 | set | files: + issue14910_2.patch |
| 2014年05月09日 04:35:22 | paul.j3 | set | files: - issue14910_2.patch |
| 2014年05月09日 03:19:06 | paul.j3 | set | files:
+ issue14910_2.patch messages: + msg218137 |
| 2014年04月14日 19:37:23 | akuchling | set | versions: + Python 3.5, - Python 3.4 |
| 2014年02月03日 15:44:48 | BreamoreBoy | set | nosy:
- BreamoreBoy |
| 2013年11月28日 17:15:48 | paul.j3 | set | nosy:
+ paul.j3 messages: + msg204678 |
| 2013年11月27日 15:12:00 | eric.smith | set | nosy:
+ eric.smith |
| 2013年11月26日 17:55:48 | eli.bendersky | set | nosy:
+ eli.bendersky |
| 2013年04月18日 10:24:22 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages: + msg187235 |
| 2013年02月05日 15:11:49 | daniel.ugra | set | nosy:
+ daniel.ugra |
| 2012年12月05日 18:45:51 | r.david.murray | link | issue16614 superseder |
| 2012年12月05日 18:45:11 | r.david.murray | set | nosy:
+ Michael.Edwards |
| 2012年07月22日 20:06:32 | r.david.murray | set | nosy:
+ r.david.murray messages: + msg166162 |
| 2012年07月22日 19:58:17 | bethard | set | messages: + msg166161 |
| 2012年07月22日 19:57:10 | bethard | set | files:
+ 14910.patch messages: + msg166160 versions: + Python 3.4, - Python 3.3 |
| 2012年05月26日 20:26:38 | jpaugh | set | files:
+ disable-abbrev.patch keywords: + patch messages: + msg161680 |
| 2012年05月26日 17:54:05 | jpaugh | set | nosy:
+ jpaugh messages: + msg161672 |
| 2012年05月25日 18:42:27 | eric.araujo | set | versions: + Python 3.3, - Python 2.6, Python 2.7 |
| 2012年05月25日 16:26:59 | tshepang | set | nosy:
+ bethard, tshepang |
| 2012年05月25日 11:04:16 | jens.jaehrig | set | title: argparse disable abbreviation -> argparse: disable abbreviation |
| 2012年05月25日 11:02:22 | jens.jaehrig | set | messages: + msg161566 |
| 2012年05月25日 10:59:55 | jens.jaehrig | create | |