Strip annotations from a docstring leaving only the text description. :param doc: documentation string
(doc: str)
| 747 | |
| 748 | |
| 749 | def 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 | |
| 774 | def similarity_function(s1: str, s2: str) -> float: |
no outgoing calls
no test coverage detected
searching dependent graphs…