string.maketrans() now produces translation tables for bytes.translate() -- wrong module?

Fix all remaining instances that did bad things with the new str.translate().
This commit is contained in:
Georg Brandl 2007-08-31 10:37:15 +00:00
parent 226878cba5
commit 7f13e6b3e2
9 changed files with 39 additions and 62 deletions

View file

@ -59,8 +59,6 @@ class TextWrapper:
Drop leading and trailing whitespace from lines.
"""
whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace))
unicode_whitespace_trans = {}
uspace = ord(' ')
for x in _whitespace:
@ -116,10 +114,7 @@ class TextWrapper:
if self.expand_tabs:
text = text.expandtabs()
if self.replace_whitespace:
if isinstance(text, str8):
text = text.translate(self.whitespace_trans)
elif isinstance(text, str):
text = text.translate(self.unicode_whitespace_trans)
text = text.translate(self.unicode_whitespace_trans)
return text