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

Method indent

Lib/pydoc.py:1237–1241  ·  view source on GitHub ↗

Indent text by prepending a given prefix to each line.

(self, text, prefix='    ')

Source from the content-addressed store, hash-verified

1235 return ''.join(ch + '\b' + ch for ch in text)
1236
1237 def indent(self, text, prefix=' '):
1238 """Indent text by prepending a given prefix to each line."""
1239 if not text: return ''
1240 lines = [(prefix + line).rstrip() for line in text.split('\n')]
1241 return '\n'.join(lines)
1242
1243 def section(self, title, contents):
1244 """Format a section with a given heading."""

Callers 7

sectionMethod · 0.95
docclassMethod · 0.95
docroutineMethod · 0.95
docdataMethod · 0.95
docotherMethod · 0.95
_exec_in_closureMethod · 0.45
_exec_awaitMethod · 0.45

Calls 3

rstripMethod · 0.45
splitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected