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

Function quick_completer

IPython/core/completerlib.py:215–236  ·  view source on GitHub ↗

r""" Easily create a trivial completer for a command. Takes either a list of completions, or all completions in string (that will be split on whitespace). Example:: [d:\ipython]|1> import ipy_completers [d:\ipython]|2> ipy_completers.quick_completer('foo', ['bar','baz'

(cmd, completions)

Source from the content-addressed store, hash-verified

213#-----------------------------------------------------------------------------
214
215def quick_completer(cmd, completions):
216 r""" Easily create a trivial completer for a command.
217
218 Takes either a list of completions, or all completions in string (that will
219 be split on whitespace).
220
221 Example::
222
223 [d:\ipython]|1> import ipy_completers
224 [d:\ipython]|2> ipy_completers.quick_completer('foo', ['bar','baz'])
225 [d:\ipython]|3> foo b<TAB>
226 bar baz
227 [d:\ipython]|3> foo ba
228 """
229
230 if isinstance(completions, str):
231 completions = completions.split()
232
233 def do_complete(self, event):
234 return completions
235
236 get_ipython().set_hook('complete_command',do_complete, str_key = cmd)
237
238def module_completion(line):
239 """

Callers

nothing calls this directly

Calls 2

get_ipythonFunction · 0.90
set_hookMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…