Return a triple-single-quoted representation of text.
(text: str, /)
| 197 | |
| 198 | |
| 199 | def _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 | |
| 207 | def setup(app: Sphinx) -> ExtensionMetadata: |