mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
Merged revisions 74990 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r74990 | tarek.ziade | 2009-09-21 15:01:54 +0200 (Mon, 21 Sep 2009) | 9 lines Merged revisions 74988 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r74988 | tarek.ziade | 2009-09-21 14:19:07 +0200 (Mon, 21 Sep 2009) | 1 line improved distutils test coverage: now the DEBUG mode is covered too (will help fix the issue #6954 in py3k branch) ........ ................
This commit is contained in:
parent
14214261c4
commit
8349669824
6 changed files with 75 additions and 6 deletions
|
@ -26,7 +26,7 @@ neg_alias_re = re.compile("^(%s)=!(%s)$" % (longopt_pat, longopt_pat))
|
|||
|
||||
# This is used to translate long options to legitimate Python identifiers
|
||||
# (for use as attributes of some object).
|
||||
longopt_xlate = lambda s: s.replace('-', '_')
|
||||
longopt_xlate = str.maketrans('-', '_')
|
||||
|
||||
class FancyGetopt:
|
||||
"""Wrapper around the standard 'getopt()' module that provides some
|
||||
|
@ -107,7 +107,7 @@ class FancyGetopt:
|
|||
"""Translate long option name 'long_option' to the form it
|
||||
has as an attribute of some object: ie., translate hyphens
|
||||
to underscores."""
|
||||
return longopt_xlate(long_option)
|
||||
return long_option.translate(longopt_xlate)
|
||||
|
||||
def _check_alias_dict(self, aliases, what):
|
||||
assert isinstance(aliases, dict)
|
||||
|
@ -432,7 +432,7 @@ def translate_longopt(opt):
|
|||
"""Convert a long option name to a valid Python identifier by
|
||||
changing "-" to "_".
|
||||
"""
|
||||
return longopt_xlate(opt)
|
||||
return opt.translate(longopt_xlate)
|
||||
|
||||
|
||||
class OptionDummy:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue