MCPcopy Create free account
hub / github.com/holoviz/hvplot / _parse_docstring_sections

Function _parse_docstring_sections

hvplot/util.py:950–976  ·  view source on GitHub ↗

Used to parse the docstring that contains all the plot options.

(docstring: str)

Source from the content-addressed store, hash-verified

948
949
950def _parse_docstring_sections(docstring: str) -> dict[str, str]:
951 """Used to parse the docstring that contains all the plot options."""
952 docstring = docstring.strip()
953 if docstring.startswith('"""') and docstring.endswith('"""'):
954 docstring = docstring[3:-3].strip()
955
956 lines = docstring.splitlines()
957 section_headers = []
958
959 for i, line in enumerate(lines):
960 if (
961 i < len(lines) - 1
962 and set(lines[i + 1].strip()) == {'-'}
963 and len(lines[i + 1].strip()) >= 3
964 ):
965 section_headers.append((i, line.strip()))
966
967 sections = {}
968 for i, section_header in enumerate(section_headers):
969 start_line = section_headers[i][0]
970 if i == len(section_headers) - 1:
971 section_text = '\n'.join(lines[start_line:])
972 else:
973 end_line = section_headers[i + 1][0]
974 section_text = '\n'.join(lines[start_line:end_line])
975 sections[section_header[1]] = section_text.strip()
976 return sections
977
978
979_METHOD_DOCS = {}

Callers 2

_get_doc_and_signatureFunction · 0.85

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…