MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / _emit_docstring

Function _emit_docstring

py/generate_bidi.py:89–108  ·  view source on GitHub ↗

r"""Produce a PEP 257-compliant docstring block with a trailing newline. Single-line output: \"\"\"text.\"\"\"\n Multi-line output: \"\"\" First line. Continuation. \"\"\" The opening and closing t

(text: str, indent_width: int)

Source from the content-addressed store, hash-verified

87
88
89def _emit_docstring(text: str, indent_width: int) -> str:
90 r"""Produce a PEP 257-compliant docstring block with a trailing newline.
91
92 Single-line output: <indent>\"\"\"text.\"\"\"\n
93 Multi-line output:
94 <indent>\"\"\"
95 <indent>First line.
96 <indent>
97 <indent>Continuation.
98 <indent>\"\"\"
99 The opening and closing triple-quotes each occupy their own line for
100 multi-line strings so that inspect.getdoc() / Sphinx dedent cleanly.
101 """
102 prefix = " " * indent_width
103 stripped = text.strip()
104 lines = stripped.splitlines()
105 if len(lines) <= 1:
106 return f'{prefix}"""{stripped}"""\n'
107 content = "\n".join(f"{prefix}{line}" if line.strip() else "" for line in lines)
108 return f'{prefix}"""\n{content}\n{prefix}"""\n'
109
110
111def load_enhancements_manifest(manifest_path: str | None) -> dict[str, Any]:

Callers 4

to_python_methodMethod · 0.85
to_python_dataclassMethod · 0.85
to_python_classMethod · 0.85
generate_codeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected