API

class supplement.remote.Environment(executable=None, env=None)

Supplement server client

__init__(executable=None, env=None)

Environment constructor

Parameters:
  • executable – path to python executable. May be path to virtualenv interpreter start script like /path/to/venv/bin/python.
  • env – environment variables dict, e.g. DJANGO_SETTINGS_MODULE value.
configure_project(project_path, config)

Reconfigure project

Parameters:
  • project_path – absolute project path
  • config – dict with config key/values
assist(project_path, source, position, filename)

Return completion match and list of completion proposals

Parameters:
  • project_path – absolute project path
  • source – unicode or byte string code source
  • position – character or byte cursor position
  • filename – absolute path of file with source code
Returns:

tuple (completion match, sorted list of proposals)

get_location(project_path, source, position, filename)

Return line number and file path where name under cursor is defined

If line is None location wasn’t finded. If file path is None, defenition is located in the same source.

Parameters:
  • project_path – absolute project path
  • source – unicode or byte string code source
  • position – character or byte cursor position
  • filename – absolute path of file with source code
Returns:

tuple (lineno, file path)

get_docstring(project_path, source, position, filename)

Return signature and docstring for current cursor call context

Some examples of call context:

func(|
func(arg|
func(arg,|

func(arg, func2(|    # call context is func2

Signature and docstring can be None

Parameters:
  • project_path – absolute project path
  • source – unicode or byte string code source
  • position – character or byte cursor position
  • filename – absolute path of file with source code
Returns:

tuple (signarure, docstring)

get_scope(project_path, source, lineno, filename, continous=True)

Return scope name at cursor position

For example:

class Foo:
    def foo(self):
        pass
        |
    def bar(self):
        pass

get_scope return Foo.foo if continuous is True and Foo otherwise.

Parameters:
  • project_path – absolute project path
  • source – unicode or byte string code source
  • position – character or byte cursor position
  • filename – absolute path of file with source code
  • continous – allow parent scope beetween children if False
close()

Shutdown server

This Page