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 ip
(
self, shell=None, namespace=None, global_namespace=None, config=None, **kwargs
)
| 2055 | UserWarning) |
| 2056 | |
| 2057 | def __init__( |
| 2058 | self, shell=None, namespace=None, global_namespace=None, config=None, **kwargs |
| 2059 | ): |
| 2060 | """IPCompleter() -> completer |
| 2061 | |
| 2062 | Return a completer object. |
| 2063 | |
| 2064 | Parameters |
| 2065 | ---------- |
| 2066 | shell |
| 2067 | a pointer to the ipython shell itself. This is needed |
| 2068 | because this completer knows about magic functions, and those can |
| 2069 | only be accessed via the ipython instance. |
| 2070 | namespace : dict, optional |
| 2071 | an optional dict where completions are performed. |
| 2072 | global_namespace : dict, optional |
| 2073 | secondary optional dict for completions, to |
| 2074 | handle cases (such as IPython embedded inside functions) where |
| 2075 | both Python scopes are visible. |
| 2076 | config : Config |
| 2077 | traitlet's config object |
| 2078 | **kwargs |
| 2079 | passed to super class unmodified. |
| 2080 | """ |
| 2081 | |
| 2082 | self.magic_escape = ESC_MAGIC |
| 2083 | self.splitter = CompletionSplitter() |
| 2084 | |
| 2085 | # _greedy_changed() depends on splitter and readline being defined: |
| 2086 | super().__init__( |
| 2087 | namespace=namespace, |
| 2088 | global_namespace=global_namespace, |
| 2089 | config=config, |
| 2090 | **kwargs, |
| 2091 | ) |
| 2092 | |
| 2093 | # List where completion matches will be stored |
| 2094 | self.matches = [] |
| 2095 | self.shell = shell |
| 2096 | # Regexp to split filenames with spaces in them |
| 2097 | self.space_name_re = re.compile(r'([^\\] )') |
| 2098 | # Hold a local ref. to glob.glob for speed |
| 2099 | self.glob = glob.glob |
| 2100 | |
| 2101 | # Determine if we are running on 'dumb' terminals, like (X)Emacs |
| 2102 | # buffers, to avoid completion problems. |
| 2103 | term = os.environ.get('TERM','xterm') |
| 2104 | self.dumb_terminal = term in ['dumb','emacs'] |
| 2105 | |
| 2106 | # Special handling of backslashes needed in win32 platforms |
| 2107 | if sys.platform == "win32": |
| 2108 | self.clean_glob = self._clean_glob_win32 |
| 2109 | else: |
| 2110 | self.clean_glob = self._clean_glob |
| 2111 | |
| 2112 | #regexp to parse docstring for function signature |
| 2113 | self.docstring_sig_re = re.compile(r'^[\w|\s.]+\(([^)]*)\).*') |
| 2114 | self.docstring_kwd_re = re.compile(r'[\s|\[]*(\w+)(?:\s*=\s*.*)') |
nothing calls this directly
no test coverage detected