MCPcopy Create free account
hub / github.com/ipython/ipython / complete

Method complete

IPython/core/completer.py:1913–1956  ·  view source on GitHub ↗

Find completions for the given text and line context. Note that both the text and the line_buffer are optional, but at least one of them must be given. Parameters ---------- text : string, optional Text to perform the completion on. If not giv

(self, text=None, line_buffer=None, cursor_pos=None)

Source from the content-addressed store, hash-verified

1911
1912
1913 def complete(self, text=None, line_buffer=None, cursor_pos=None):
1914 """Find completions for the given text and line context.
1915
1916 Note that both the text and the line_buffer are optional, but at least
1917 one of them must be given.
1918
1919 Parameters
1920 ----------
1921 text : string, optional
1922 Text to perform the completion on. If not given, the line buffer
1923 is split using the instance's CompletionSplitter object.
1924
1925 line_buffer : string, optional
1926 If not given, the completer attempts to obtain the current line
1927 buffer via readline. This keyword allows clients which are
1928 requesting for text completions in non-readline contexts to inform
1929 the completer of the entire text.
1930
1931 cursor_pos : int, optional
1932 Index of the cursor in the full line buffer. Should be provided by
1933 remote frontends where kernel has no access to frontend state.
1934
1935 Returns
1936 -------
1937 text : str
1938 Text that was actually used in the completion.
1939
1940 matches : list
1941 A list of completion matches.
1942
1943
1944 .. note::
1945
1946 This API is likely to be deprecated and replaced by
1947 :any:`IPCompleter.completions` in the future.
1948
1949
1950 """
1951 warnings.warn('`Completer.complete` is pending deprecation since '
1952 'IPython 6.0 and will be replaced by `Completer.completions`.',
1953 PendingDeprecationWarning)
1954 # potential todo, FOLD the 3rd throw away argument of _complete
1955 # into the first 2 one.
1956 return self._complete(line_buffer=line_buffer, cursor_pos=cursor_pos, text=text, cursor_line=0)[:2]
1957
1958 def _complete(self, *, cursor_line, cursor_pos, line_buffer=None, text=None,
1959 full_text=None) -> Tuple[str, List[str], List[str], Iterable[_FakeJediCompletion]]:

Callers 1

all_completionsMethod · 0.95

Calls 2

_completeMethod · 0.95
warnMethod · 0.80

Tested by

no test coverage detected