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

Method __init__

IPython/core/completer.py:1049–1117  ·  view source on GitHub ↗

IPCompleter() -> completer Return a completer object. Parameters ---------- shell a pointer to the ipython shell itself. This is needed because this completer knows about magic functions, and those can only be accessed via the i

(self, shell=None, namespace=None, global_namespace=None,
                 use_readline=_deprecation_readline_sentinel, config=None, **kwargs)

Source from the content-addressed store, hash-verified

1047 UserWarning)
1048
1049 def __init__(self, shell=None, namespace=None, global_namespace=None,
1050 use_readline=_deprecation_readline_sentinel, config=None, **kwargs):
1051 """IPCompleter() -> completer
1052
1053 Return a completer object.
1054
1055 Parameters
1056 ----------
1057
1058 shell
1059 a pointer to the ipython shell itself. This is needed
1060 because this completer knows about magic functions, and those can
1061 only be accessed via the ipython instance.
1062
1063 namespace : dict, optional
1064 an optional dict where completions are performed.
1065
1066 global_namespace : dict, optional
1067 secondary optional dict for completions, to
1068 handle cases (such as IPython embedded inside functions) where
1069 both Python scopes are visible.
1070
1071 use_readline : bool, optional
1072 DEPRECATED, ignored since IPython 6.0, will have no effects
1073 """
1074
1075 self.magic_escape = ESC_MAGIC
1076 self.splitter = CompletionSplitter()
1077
1078 if use_readline is not _deprecation_readline_sentinel:
1079 warnings.warn('The `use_readline` parameter is deprecated and ignored since IPython 6.0.',
1080 DeprecationWarning, stacklevel=2)
1081
1082 # _greedy_changed() depends on splitter and readline being defined:
1083 Completer.__init__(self, namespace=namespace, global_namespace=global_namespace,
1084 config=config, **kwargs)
1085
1086 # List where completion matches will be stored
1087 self.matches = []
1088 self.shell = shell
1089 # Regexp to split filenames with spaces in them
1090 self.space_name_re = re.compile(r'([^\\] )')
1091 # Hold a local ref. to glob.glob for speed
1092 self.glob = glob.glob
1093
1094 # Determine if we are running on 'dumb' terminals, like (X)Emacs
1095 # buffers, to avoid completion problems.
1096 term = os.environ.get('TERM','xterm')
1097 self.dumb_terminal = term in ['dumb','emacs']
1098
1099 # Special handling of backslashes needed in win32 platforms
1100 if sys.platform == "win32":
1101 self.clean_glob = self._clean_glob_win32
1102 else:
1103 self.clean_glob = self._clean_glob
1104
1105 #regexp to parse docstring for function signature
1106 self.docstring_sig_re = re.compile(r'^[\w|\s.]+\(([^)]*)\).*')

Callers

nothing calls this directly

Calls 3

CompletionSplitterClass · 0.85
warnMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected