MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / strip_doc_annotations

Function strip_doc_annotations

cmd2/utils.py:749–771  ·  view source on GitHub ↗

Strip annotations from a docstring leaving only the text description. :param doc: documentation string

(doc: str)

Source from the content-addressed store, hash-verified

747
748
749def strip_doc_annotations(doc: str) -> str:
750 """Strip annotations from a docstring leaving only the text description.
751
752 :param doc: documentation string
753 """
754 # Attempt to locate the first documentation block
755 cmd_desc = ""
756 found_first = False
757 for doc_line in doc.splitlines():
758 stripped_line = doc_line.strip()
759
760 # Don't include :param type lines
761 if stripped_line.startswith(":"):
762 if found_first:
763 break
764 elif stripped_line:
765 if found_first:
766 cmd_desc += "\n"
767 cmd_desc += stripped_line
768 found_first = True
769 elif found_first:
770 break
771 return cmd_desc
772
773
774def similarity_function(s1: str, s2: str) -> float:

Callers 4

getMethod · 0.85
_register_subcommandsMethod · 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…