MCPcopy Index your code
hub / github.com/RustPython/RustPython / indent

Method indent

Lib/pydoc.py:1282–1286  ·  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

1280 return ''.join(ch + '\b' + ch for ch in text)
1281
1282 def indent(self, text, prefix=' '):
1283 """Indent text by prepending a given prefix to each line."""
1284 if not text: return ''
1285 lines = [(prefix + line).rstrip() for line in text.split('\n')]
1286 return '\n'.join(lines)
1287
1288 def section(self, title, contents):
1289 """Format a section with a given heading."""

Callers 15

sectionMethod · 0.95
docclassMethod · 0.95
docroutineMethod · 0.95
docdataMethod · 0.95
docotherMethod · 0.95
indentFunction · 0.45
checkMethod · 0.45
check_scopesMethod · 0.45
_check_in_scopesMethod · 0.45
check_bodyMethod · 0.45

Calls 3

rstripMethod · 0.45
splitMethod · 0.45
joinMethod · 0.45

Tested by 10

checkMethod · 0.36
check_scopesMethod · 0.36
_check_in_scopesMethod · 0.36
check_bodyMethod · 0.36
test_indentMethod · 0.36
test_indent_spaceMethod · 0.36
test_indent_levelMethod · 0.36