mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
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:
parent
226878cba5
commit
7f13e6b3e2
9 changed files with 39 additions and 62 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue