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

Function wrap

Lib/textwrap.py:373–384  ·  view source on GitHub ↗

Wrap a single paragraph of text, returning a list of wrapped lines. Reformat the single paragraph in 'text' so it fits in lines of no more than 'width' columns, and return a list of wrapped lines. By default, tabs in 'text' are expanded with string.expandtabs(), and all other white

(text, width=70, **kwargs)

Source from the content-addressed store, hash-verified

371# -- Convenience interface ---------------------------------------------
372
373def wrap(text, width=70, **kwargs):
374 """Wrap a single paragraph of text, returning a list of wrapped lines.
375
376 Reformat the single paragraph in 'text' so it fits in lines of no
377 more than 'width' columns, and return a list of wrapped lines. By
378 default, tabs in 'text' are expanded with string.expandtabs(), and
379 all other whitespace characters (including newline) are converted to
380 space. See TextWrapper class for available keyword args to customize
381 wrapping behaviour.
382 """
383 w = TextWrapper(width=width, **kwargs)
384 return w.wrap(text)
385
386def fill(text, width=70, **kwargs):
387 """Fill a single paragraph of text, returning a new string.

Callers 4

check_wrapMethod · 0.90
test_placeholderMethod · 0.90
test_nobreak_longMethod · 0.90
test_initial_indentMethod · 0.90

Calls 2

wrapMethod · 0.95
TextWrapperClass · 0.70

Tested by 4

check_wrapMethod · 0.72
test_placeholderMethod · 0.72
test_nobreak_longMethod · 0.72
test_initial_indentMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…