Make the signature from a jedi completion Parameters ---------- completion : jedi.Completion object does not complete a function type Returns ------- a string consisting of the function signature, with the parenthesis but without the function name. example:
(completion)
| 1832 | return description[6:] |
| 1833 | |
| 1834 | def _make_signature(completion)-> str: |
| 1835 | """ |
| 1836 | Make the signature from a jedi completion |
| 1837 | |
| 1838 | Parameters |
| 1839 | ---------- |
| 1840 | completion : jedi.Completion |
| 1841 | object does not complete a function type |
| 1842 | |
| 1843 | Returns |
| 1844 | ------- |
| 1845 | a string consisting of the function signature, with the parenthesis but |
| 1846 | without the function name. example: |
| 1847 | `(a, *args, b=1, **kwargs)` |
| 1848 | |
| 1849 | """ |
| 1850 | |
| 1851 | # it looks like this might work on jedi 0.17 |
| 1852 | if hasattr(completion, 'get_signatures'): |
| 1853 | signatures = completion.get_signatures() |
| 1854 | if not signatures: |
| 1855 | return '(?)' |
| 1856 | |
| 1857 | c0 = completion.get_signatures()[0] |
| 1858 | return '('+c0.to_string().split('(', maxsplit=1)[1] |
| 1859 | |
| 1860 | return '(%s)'% ', '.join([f for f in (_formatparamchildren(p) for signature in completion.get_signatures() |
| 1861 | for p in signature.defined_names()) if f]) |
| 1862 | |
| 1863 | |
| 1864 | _CompleteResult = dict[str, MatcherResult] |
no test coverage detected
searching dependent graphs…