Skip to content

Commit

Permalink
Use maktaba#python#Eval for Python 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Sep 20, 2017
1 parent 97ad576 commit 88d0204
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions autoload/coverage/python.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,6 @@ function! s:GetCoverageFile() abort
return fnamemodify(findfile('.coverage', ';'), ':p')
endfunction

" Polyfill for vim's pyeval().
" TODO(google/vim-maktaba#70): Use maktaba's implementation when available.
function! s:PyEval(expr) abort
if exists('*pyeval')
return pyeval(a:expr)
endif
python import json, vim
python vim.command('return ' + json.dumps(eval(vim.eval('a:expr'))))
endfunction

function! coverage#python#GetCoveragePyProvider() abort
let l:provider = {
\ 'name': 'coverage.py'}
Expand All @@ -59,7 +49,7 @@ function! coverage#python#GetCoveragePyProvider() abort
\ 'Generate one by running nosetests --with-coverage')
endif
call maktaba#python#ImportModule(s:plugin, 'vim_coverage')
let l:coverage_data = s:PyEval(printf(
let l:coverage_data = maktaba#python#Eval(printf(
\ 'vim_coverage.GetCoveragePyLines(%s, %s)',
\ string(l:cov_file),
\ string(a:filename)))
Expand Down

0 comments on commit 88d0204

Please sign in to comment.