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

Function fill

Lib/textwrap.py:386–396  ·  view source on GitHub ↗

Fill a single paragraph of text, returning a new string. Reformat the single paragraph in 'text' to fit in lines of no more than 'width' columns, and return a new string containing the entire wrapped paragraph. As with wrap(), tabs are expanded and other whitespace characters conve

(text, width=70, **kwargs)

Source from the content-addressed store, hash-verified

384 return w.wrap(text)
385
386def fill(text, width=70, **kwargs):
387 """Fill a single paragraph of text, returning a new string.
388
389 Reformat the single paragraph in 'text' to fit in lines of no more
390 than 'width' columns, and return a new string containing the entire
391 wrapped paragraph. As with wrap(), tabs are expanded and other
392 whitespace characters converted to space. See TextWrapper class for
393 available keyword args to customize wrapping behaviour.
394 """
395 w = TextWrapper(width=width, **kwargs)
396 return w.fill(text)
397
398def shorten(text, width, **kwargs):
399 """Collapse and truncate the given text to fit in the given width.

Callers 4

test_fillMethod · 0.90
test_initial_indentMethod · 0.90
test_fillMethod · 0.85

Calls 2

fillMethod · 0.95
TextWrapperClass · 0.70

Tested by 4

test_fillMethod · 0.72
test_initial_indentMethod · 0.72
test_fillMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…