Exemplo n.º 1
0
    def goto_assignments(self,
                         follow_imports=False,
                         follow_builtin_imports=False,
                         **kwargs):
        """
        Return the first definition found, while optionally following imports.
        Multiple objects may be returned, because Python itself is a
        dynamic language, which means depending on an option you can have two
        different versions of a function.

        .. note:: It is deprecated to use follow_imports and follow_builtin_imports as
            positional arguments. Will be a keyword argument in 0.16.0.

        :param follow_imports: The goto call will follow imports.
        :param follow_builtin_imports: If follow_imports is True will decide if
            it follow builtin imports.
        :param only_stubs: Only return stubs for this goto call.
        :param prefer_stubs: Prefer stubs to Python objects for this goto call.
        :rtype: list of :class:`classes.Definition`
        """
        with debug.increase_indent_cm('goto_assignments'):
            return self._goto_assignments(follow_imports,
                                          follow_builtin_imports, **kwargs)
Exemplo n.º 2
0
    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()
Exemplo n.º 3
0
def _execute(context, arguments):
    debug.dbg('execute: %s %s', context, arguments)
    with debug.increase_indent_cm():
        context_set = context.py__call__(arguments=arguments)
    debug.dbg('execute result: %s in %s', context_set, context)
    return context_set
Exemplo n.º 4
0
 def execute(value, arguments):
     debug.dbg('execute: %s %s', value, arguments)
     with debug.increase_indent_cm():
         value_set = value.py__call__(arguments=arguments)
     debug.dbg('execute result: %s in %s', value_set, value)
     return value_set
Exemplo n.º 5
0
 def _wrapped_value(self):
     with debug.increase_indent_cm('Resolve lazy value wrapper'):
         return self._get_wrapped_value()
Exemplo n.º 6
0
 def infer(self, **kwargs):  # Python 2...
     with debug.increase_indent_cm('infer for %s' % self._name):
         return self._infer(**kwargs)
Exemplo n.º 7
0
 def goto_assignments(self, **kwargs):  # Python 2...
     with debug.increase_indent_cm('goto for %s' % self._name):
         return self._goto_assignments(**kwargs)
Exemplo n.º 8
0
 def goto(self, **kwargs):
     with debug.increase_indent_cm('goto for %s' % self._name):
         return self._goto(**kwargs)
 def _wrapped_context(self):
     with debug.increase_indent_cm('Resolve lazy context wrapper'):
         return self._get_wrapped_context()