diff --git a/__init__.py b/__init__.py index 2caa899c..cddf7860 100644 --- a/__init__.py +++ b/__init__.py @@ -1,2 +1,2 @@ -from functions import * +from api import * import settings diff --git a/functions.py b/api.py similarity index 100% rename from functions.py rename to api.py diff --git a/plugin/jedi.vim b/plugin/jedi.vim index bdab75bd..6f1aef9b 100644 --- a/plugin/jedi.vim +++ b/plugin/jedi.vim @@ -177,8 +177,8 @@ if 1: buf_path = vim.current.buffer.name source = '\n'.join(vim.current.buffer) try: - definitions = functions.get_definition(source, row, column, buf_path) - except functions.NotFoundError: + definitions = api.get_definition(source, row, column, buf_path) + except api.NotFoundError: definitions = [] except Exception: # print to stdout, will be in :messages @@ -431,7 +431,7 @@ import re # normally you should import jedi. jedi-vim is an exception, because you can # copy that directly into the .vim directory. -import functions +import api temp_rename = None # used for jedi#rename @@ -453,7 +453,7 @@ def get_script(source=None, column=None): if column is None: column = vim.current.window.cursor[1] buf_path = vim.current.buffer.name - return functions.Script(source, row, column, buf_path) + return api.Script(source, row, column, buf_path) def _goto(is_definition=False, is_related_name=False, no_output=False): @@ -466,7 +466,7 @@ def _goto(is_definition=False, is_related_name=False, no_output=False): definitions = script.get_definition() else: definitions = script.goto() - except functions.NotFoundError: + except api.NotFoundError: echo_highlight("Cannot follow nothing. Put your cursor on a valid name.") except Exception: # print to stdout, will be in :messages @@ -485,7 +485,7 @@ def _goto(is_definition=False, is_related_name=False, no_output=False): d = list(definitions)[0] if d.in_builtin_module(): - if isinstance(d.definition, functions.keywords.Keyword): + if isinstance(d.definition, api.keywords.Keyword): echo_highlight("Cannot get the definition of Python keywords.") else: echo_highlight("Builtin modules cannot be displayed.") diff --git a/test/regression.py b/test/regression.py index 7d564389..2f5aab78 100755 --- a/test/regression.py +++ b/test/regression.py @@ -9,23 +9,23 @@ os.chdir(os.path.dirname(os.path.abspath(__file__)) + '/..') sys.path.append('.') from _compatibility import is_py25 -import functions -#functions.set_debug_function(functions.debug.print_to_stdout) +import api +#api.set_debug_function(api.debug.print_to_stdout) class TestRegression(unittest.TestCase): def get_def(self, src, pos): - script = functions.Script(src, pos[0], pos[1], '') + script = api.Script(src, pos[0], pos[1], '') return script.get_definition() def complete(self, src, pos): - script = functions.Script(src, pos[0], pos[1], '') + script = api.Script(src, pos[0], pos[1], '') return script.complete() def get_in_function_call(self, src, pos=None): if pos is None: pos = 1, len(src) - script = functions.Script(src, pos[0], pos[1], '') + script = api.Script(src, pos[0], pos[1], '') return script.get_in_function_call() def test_get_definition_cursor(self): @@ -61,7 +61,7 @@ class TestRegression(unittest.TestCase): #print should2, diff_line assert should2 == diff_line - self.assertRaises(functions.NotFoundError, get_def, cls) + self.assertRaises(api.NotFoundError, get_def, cls) def test_keyword_doc(self): r = list(self.get_def("or", (1, 1))) @@ -108,7 +108,7 @@ class TestRegression(unittest.TestCase): s = ("def abc(): pass\n" "abc.d.a.abc.d" ) - functions.Script(s, 2, 2, '/').related_names() + api.Script(s, 2, 2, '/').related_names() def test_get_in_function_call(self): s = "isinstance(a, abs(" diff --git a/test/run.py b/test/run.py index 19536324..9d99db16 100755 --- a/test/run.py +++ b/test/run.py @@ -10,7 +10,7 @@ os.chdir(dirname(abspath(__file__)) + '/..') from _compatibility import unicode, BytesIO, reduce, literal_eval, is_py25 -import functions +import api import debug sys.path.pop() # pop again, because it might affect the completion @@ -110,7 +110,7 @@ def run_test(source, f_name, lines_to_execute): """ def get_defs(correct, correct_start, path): def defs(line_nr, indent): - script = functions.Script(source, line_nr, indent, path) + script = api.Script(source, line_nr, indent, path) return set(script.get_definition()) should_be = set() @@ -121,7 +121,7 @@ def run_test(source, f_name, lines_to_execute): # -1 for the comment, +3 because of the comment start `#? ` start = index.start() if print_debug: - functions.set_debug_function(None) + api.set_debug_function(None) number += 1 try: should_be |= defs(line_nr - 1, start + correct_start) @@ -129,7 +129,7 @@ def run_test(source, f_name, lines_to_execute): raise Exception('could not resolve %s indent %s' % (line_nr - 1, start)) if print_debug: - functions.set_debug_function(debug.print_to_stdout) + api.set_debug_function(debug.print_to_stdout) # because the objects have different ids, `repr` it, then compare it. should_str = set(r.desc_with_module for r in should_be) if len(should_str) < number: @@ -157,7 +157,7 @@ def run_test(source, f_name, lines_to_execute): # get_definition test path = completion_test_dir + os.path.sep + f_name try: - script = functions.Script(source, line_nr, index, path) + script = api.Script(source, line_nr, index, path) if test_type == '!': fails += run_goto_test(script, correct, line_nr) elif test_type == '<': @@ -238,7 +238,7 @@ except ValueError: pass else: print_debug = True - functions.set_debug_function(debug.print_to_stdout) + api.set_debug_function(debug.print_to_stdout) # get test list, that should be executed test_files = {}