Remove functions in string module that are also string methods. Also remove:
* all calls to functions in the string module (except maketrans)
* everything from stropmodule except for maketrans() which is still used
diff --git a/Lib/distutils/fancy_getopt.py b/Lib/distutils/fancy_getopt.py
index 646f8e1..317a3a4 100644
--- a/Lib/distutils/fancy_getopt.py
+++ b/Lib/distutils/fancy_getopt.py
@@ -115,7 +115,7 @@
"""Translate long option name 'long_option' to the form it
has as an attribute of some object: ie., translate hyphens
to underscores."""
- return string.translate(long_option, longopt_xlate)
+ return long_option.translate(longopt_xlate)
def _check_alias_dict (self, aliases, what):
@@ -253,7 +253,7 @@
self._grok_option_table()
- short_opts = string.join(self.short_opts)
+ short_opts = ' '.join(self.short_opts)
try:
opts, args = getopt.getopt(args, short_opts, self.long_opts)
except getopt.error as msg:
@@ -420,8 +420,8 @@
if len(text) <= width:
return [text]
- text = string.expandtabs(text)
- text = string.translate(text, WS_TRANS)
+ text = text.expandtabs()
+ text = text.translate(WS_TRANS)
chunks = re.split(r'( +|-+)', text)
chunks = filter(None, chunks) # ' - ' results in empty strings
lines = []
@@ -460,7 +460,7 @@
# and store this line in the list-of-all-lines -- as a single
# string, of course!
- lines.append(string.join(cur_line, ''))
+ lines.append(''.join(cur_line))
# while chunks
@@ -473,7 +473,7 @@
"""Convert a long option name to a valid Python identifier by
changing "-" to "_".
"""
- return string.translate(opt, longopt_xlate)
+ return opt.translate(longopt_xlate)
class OptionDummy:
@@ -498,5 +498,5 @@
for w in (10, 20, 30, 40):
print("width: %d" % w)
- print(string.join(wrap_text(text, w), "\n"))
+ print("\n".join(wrap_text(text, w)))
print()