MCPcopy Index your code
hub / github.com/python/cpython / _split

Method _split

Lib/textwrap.py:157–177  ·  view source on GitHub ↗

_split(text : string) -> [string] Split the text to wrap into indivisible chunks. Chunks are not quite the same as words; see _wrap_chunks() for full details. As an example, the text Look, goof-ball -- use the -b option! breaks into the following chunks:

(self, text)

Source from the content-addressed store, hash-verified

155
156
157 def _split(self, text):
158 """_split(text : string) -> [string]
159
160 Split the text to wrap into indivisible chunks. Chunks are
161 not quite the same as words; see _wrap_chunks() for full
162 details. As an example, the text
163 Look, goof-ball -- use the -b option!
164 breaks into the following chunks:
165 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
166 'use', ' ', 'the', ' ', '-b', ' ', 'option!'
167 if break_on_hyphens is True, or in:
168 'Look,', ' ', 'goof-ball', ' ', '--', ' ',
169 'use', ' ', 'the', ' ', '-b', ' ', option!'
170 otherwise.
171 """
172 if self.break_on_hyphens is True:
173 chunks = self.wordsep_re.split(text)
174 else:
175 chunks = self.wordsep_simple_re.split(text)
176 chunks = [c for c in chunks if c]
177 return chunks
178
179 def _fix_sentence_endings(self, chunks):
180 """_fix_sentence_endings(chunks : [string])

Callers 6

_split_chunksMethod · 0.95
actualMethod · 0.80
configMethod · 0.80
metricsMethod · 0.80
check_splitMethod · 0.80
test_splitMethod · 0.80

Calls 1

splitMethod · 0.45

Tested by 2

check_splitMethod · 0.64
test_splitMethod · 0.64