MCPcopy Index your code
hub / github.com/ipython/ipython / _make_signature

Function _make_signature

IPython/core/completer.py:1834–1861  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1832 return description[6:]
1833
1834def _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]

Callers 1

_completionsMethod · 0.85

Calls 1

_formatparamchildrenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…