From 0f7b743b4e02224742b179a6b83f44c833f23bd1 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 6 Apr 2016 17:22:47 +0200 Subject: [PATCH] Clarify arguments with _catch_exception The whole int/string conversion with `vim.eval` is confusing enough, use a boolean for `is_eval`. --- jedi_vim.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jedi_vim.py b/jedi_vim.py index f6aeb18..377ee87 100644 --- a/jedi_vim.py +++ b/jedi_vim.py @@ -62,19 +62,19 @@ def _catch_exception(string, is_eval): Interface between vim and python calls back to it. Necessary, because the exact error message is not given by `vim.error`. """ - e = 'jedi#_vim_exceptions(%s, %s)' - result = vim.eval(e % (repr(PythonToVimStr(string, 'UTF-8')), is_eval)) + result = vim.eval('jedi#_vim_exceptions({0}, {1})'.format( + repr(PythonToVimStr(string, 'UTF-8')), int(is_eval))) if 'exception' in result: raise VimError(result['exception'], result['throwpoint'], string) return result['result'] def vim_command(string): - _catch_exception(string, 0) + _catch_exception(string, False) def vim_eval(string): - return _catch_exception(string, 1) + return _catch_exception(string, True) def no_jedi_warning(error=None):