{ } Raw JSON

bundles / papyri latest / papyri / utils / strip_clinic_signature

function

papyri.utils:strip_clinic_signature

source: /papyri/utils.py:102

Signature

def strip_clinic_signature(text: str) → tuple[str | None, str]

Summary

Strip Python C clinic signature lines from a docstring.

Extended Summary

C extension __doc__ strings often start with:

FuncName(args) --

The -- is a clinic separator, not RST. Tree-sitter RST misreads it as a section underline (which fails because the underline is shorter than the title). Strip those two lines so the RST parser sees only the body.

Returns

: (clinic_sig, body)

clinic_sig is the extracted signature line (e.g. "MyClass(x, y=1)"), or None if no clinic prefix was found. body is the remaining docstring text.

Aliases

  • papyri.gen.strip_clinic_signature