def completions(self): """ Return :class:`classes.Completion` objects. Those objects contain information about the completions, more than just names. :return: Completion objects, sorted by name and __ comes last. :rtype: list of :class:`classes.Completion` """ debug.speed('completions start') completion = Completion( self._evaluator, self._get_module(), self._code_lines, self._pos, self.call_signatures ) completions = completion.completions() def iter_import_completions(): for c in completions: tree_name = c._name.tree_name if tree_name is None: continue definition = tree_name.get_definition() if definition is not None \ and definition.type in ('import_name', 'import_from'): yield c if len(list(iter_import_completions())) > 10: # For now disable completions if there's a lot of imports that # might potentially be resolved. This is the case for tensorflow # and has been fixed for it. This is obviously temporary until we # have a better solution. self._evaluator.infer_enabled = False debug.speed('completions end') return completions
def _complete(self, line, column, fuzzy=False): # Python 2... with debug.increase_indent_cm('complete'): completion = Completion( self._inference_state, self._get_module_context(), self._code_lines, (line, column), self.find_signatures, fuzzy=fuzzy, ) return completion.complete()
def completions(self): """ Return :class:`classes.Completion` objects. Those objects contain information about the completions, more than just names. :return: Completion objects, sorted by name and __ comes last. :rtype: list of :class:`classes.Completion` """ with debug.increase_indent_cm('completions'): completion = Completion(self._evaluator, self._get_module(), self._code_lines, self._pos, self.call_signatures) return completion.completions()
def completions(self): """ Return :class:`classes.Completion` objects. Those objects contain information about the completions, more than just names. :return: Completion objects, sorted by name and __ comes last. :rtype: list of :class:`classes.Completion` """ debug.speed('completions start') completion = Completion(self._evaluator, self._get_module(), self._code_lines, self._pos, self.call_signatures) completions = completion.completions() debug.speed('completions end') return completions
def complete(self, line=None, column=None, *, fuzzy=False): """ Completes objects under the cursor. Those objects contain information about the completions, more than just names. :param fuzzy: Default False. Will return fuzzy completions, which means that e.g. ``ooa`` will match ``foobar``. :return: Completion objects, sorted by name. Normal names appear before "private" names that start with ``_`` and those appear before magic methods and name mangled names that start with ``__``. :rtype: list of :class:`.Completion` """ with debug.increase_indent_cm('complete'): completion = Completion( self._inference_state, self._get_module_context(), self._code_lines, (line, column), self.get_signatures, fuzzy=fuzzy, ) return completion.complete()