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

Method wrap

Lib/textwrap.py:347–359  ·  view source on GitHub ↗

wrap(text : string) -> [string] Reformat the single paragraph in 'text' so it fits in lines of no more than 'self.width' columns, and return a list of wrapped lines. Tabs in 'text' are expanded with string.expandtabs(), and all other whitespace characters (including

(self, text)

Source from the content-addressed store, hash-verified

345 # -- Public interface ----------------------------------------------
346
347 def wrap(self, text):
348 """wrap(text : string) -> [string]
349
350 Reformat the single paragraph in 'text' so it fits in lines of
351 no more than 'self.width' columns, and return a list of wrapped
352 lines. Tabs in 'text' are expanded with string.expandtabs(),
353 and all other whitespace characters (including newline) are
354 converted to space.
355 """
356 chunks = self._split_chunks(text)
357 if self.fix_sentence_endings:
358 self._fix_sentence_endings(chunks)
359 return self._wrap_chunks(chunks)
360
361 def fill(self, text):
362 """fill(text : string) -> string

Callers 10

fillMethod · 0.95
wrapFunction · 0.95
test_whitespaceMethod · 0.95
show_warningMethod · 0.95
showtopicMethod · 0.45
_split_linesMethod · 0.45
format_optionMethod · 0.45
format_arrayFunction · 0.45
wrapped_c_string_literalFunction · 0.45

Calls 3

_split_chunksMethod · 0.95
_fix_sentence_endingsMethod · 0.95
_wrap_chunksMethod · 0.95

Tested by 2

test_whitespaceMethod · 0.76