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

Method init_completer

IPython/core/interactiveshell.py:2137–2166  ·  view source on GitHub ↗

Initialize the completion machinery. This creates completion machinery that can be used by client code, either interactively in-process (typically triggered by the readline library), programmatically (such as in test suites) or out-of-process (typically over the netw

(self)

Source from the content-addressed store, hash-verified

2135 #-------------------------------------------------------------------------
2136
2137 def init_completer(self):
2138 """Initialize the completion machinery.
2139
2140 This creates completion machinery that can be used by client code,
2141 either interactively in-process (typically triggered by the readline
2142 library), programmatically (such as in test suites) or out-of-process
2143 (typically over the network by remote frontends).
2144 """
2145 from IPython.core.completer import IPCompleter
2146 from IPython.core.completerlib import (module_completer,
2147 magic_run_completer, cd_completer, reset_completer)
2148
2149 self.Completer = IPCompleter(shell=self,
2150 namespace=self.user_ns,
2151 global_namespace=self.user_global_ns,
2152 parent=self,
2153 )
2154 self.configurables.append(self.Completer)
2155
2156 # Add custom completers to the basic ones built into IPCompleter
2157 sdisp = self.strdispatchers.get('complete_command', StrDispatch())
2158 self.strdispatchers['complete_command'] = sdisp
2159 self.Completer.custom_completers = sdisp
2160
2161 self.set_hook('complete_command', module_completer, str_key = 'import')
2162 self.set_hook('complete_command', module_completer, str_key = 'from')
2163 self.set_hook('complete_command', module_completer, str_key = '%aimport')
2164 self.set_hook('complete_command', magic_run_completer, str_key = '%run')
2165 self.set_hook('complete_command', cd_completer, str_key = '%cd')
2166 self.set_hook('complete_command', reset_completer, str_key = '%reset')
2167
2168 @skip_doctest
2169 def complete(self, text, line=None, cursor_pos=None):

Callers 1

__init__Method · 0.95

Calls 3

set_hookMethod · 0.95
IPCompleterClass · 0.90
StrDispatchClass · 0.90

Tested by

no test coverage detected