MCPcopy Index your code
hub / github.com/sphinx-doc/sphinx / dedent_docstring

Function dedent_docstring

sphinx/pycode/parser.py:90–102  ·  view source on GitHub ↗

Remove common leading indentation from docstring.

(s: str)

Source from the content-addressed store, hash-verified

88
89
90def dedent_docstring(s: str) -> str:
91 """Remove common leading indentation from docstring."""
92
93 def dummy() -> None:
94 # dummy function to mock `inspect.getdoc`.
95 pass
96
97 dummy.__doc__ = s
98 docstring = inspect.getdoc(dummy)
99 if docstring:
100 return docstring.lstrip('\r\n').rstrip('\r\n')
101 else:
102 return ''
103
104
105class Token:

Callers 2

_collect_doc_commentMethod · 0.85
visit_ExprMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…