diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-09-21 13:01:54 (GMT) |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-09-21 13:01:54 (GMT) |
commit | 03d5d087989fc38df2bee68a3f5ed758b0bfa665 (patch) | |
tree | 7a1341e9e5dac79d1d4c84fbae2cdaf2f9723f94 /Lib/distutils/fancy_getopt.py | |
parent | eb097fca52f47d012df127c7c83d72a8e3881d73 (diff) | |
download | cpython-03d5d087989fc38df2bee68a3f5ed758b0bfa665.zip cpython-03d5d087989fc38df2bee68a3f5ed758b0bfa665.tar.gz cpython-03d5d087989fc38df2bee68a3f5ed758b0bfa665.tar.bz2 |
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)
........
Diffstat (limited to 'Lib/distutils/fancy_getopt.py')
-rw-r--r-- | Lib/distutils/fancy_getopt.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/distutils/fancy_getopt.py b/Lib/distutils/fancy_getopt.py index 72441fb..879d4d2 100644 --- a/Lib/distutils/fancy_getopt.py +++ b/Lib/distutils/fancy_getopt.py @@ -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: |