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

Function _repr

Doc/tools/extensions/pydoc_topics.py:199–204  ·  view source on GitHub ↗

Return a triple-single-quoted representation of text.

(text: str, /)

Source from the content-addressed store, hash-verified

197
198
199def _repr(text: str, /) -> str:
200 """Return a triple-single-quoted representation of text."""
201 if "'''" not in text:
202 return f"r'''{text}'''"
203 text = text.replace("\\", "\\\\").replace("'''", r"\'\'\'")
204 return f"'''{text}'''"
205
206
207def setup(app: Sphinx) -> ExtensionMetadata:

Callers 1

finishMethod · 0.70

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…