SF #847346: merge from release23-maint branch: remove misguided

optimization for short input; beef up tests for fix_sentence_endings
feature.
This commit is contained in:
Greg Ward 2004-05-13 01:53:10 +00:00
parent 10c660673e
commit f0ba764dbb
2 changed files with 49 additions and 13 deletions

View file

@ -90,14 +90,14 @@ class TextWrapper:
% string.lowercase)
def __init__ (self,
width=70,
initial_indent="",
subsequent_indent="",
expand_tabs=True,
replace_whitespace=True,
fix_sentence_endings=False,
break_long_words=True):
def __init__(self,
width=70,
initial_indent="",
subsequent_indent="",
expand_tabs=True,
replace_whitespace=True,
fix_sentence_endings=False,
break_long_words=True):
self.width = width
self.initial_indent = initial_indent
self.subsequent_indent = subsequent_indent
@ -268,8 +268,6 @@ class TextWrapper:
"""
text = self._munge_whitespace(text)
indent = self.initial_indent
if len(text) + len(indent) <= self.width:
return [indent + text]
chunks = self._split(text)
if self.fix_sentence_endings:
self._fix_sentence_endings(chunks)