Skip to content

Commit

Permalink
Merge pull request #527 from prologic/master
Browse files Browse the repository at this point in the history
Fixes Python 2.6 compatibility issues with `str.format()`
  • Loading branch information
davidhalter committed Jan 14, 2016
2 parents dc23f0b + 8215b22 commit 625c568
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def run(self):
[VSPEC_RUNNER, '.', VSPEC_FOLDER, self.path])
for line in output.splitlines():
if line.startswith(b'not ok') or line.startswith(b'Error'):
pytest.fail("{} failed:\n{}".format(
pytest.fail("{0} failed:\n{1}".format(
self.path, output.decode('utf-8')), pytrace=False)

def __repr__(self):
Expand Down
18 changes: 9 additions & 9 deletions jedi_vim.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ def vim_eval(string):
def no_jedi_warning(error=None):
msg = "Please install Jedi if you want to use jedi-vim."
if error:
msg = '{} The error was: {}'.format(msg, error)
msg = '{0} The error was: {1}'.format(msg, error)
vim.command('echohl WarningMsg'
'| echom "Please install Jedi if you want to use jedi-vim."'
'| echohl None')


def echo_highlight(msg):
vim_command('echohl WarningMsg | echom "{}" | echohl None'.format(
vim_command('echohl WarningMsg | echom "{0}" | echohl None'.format(
msg.replace('"', '\\"')))


Expand All @@ -101,7 +101,7 @@ def echo_highlight(msg):
try:
version = jedi.__version__
except Exception as e: # e.g. AttributeError
echo_highlight("Could not load jedi python module: {}".format(e))
echo_highlight("Could not load jedi python module: {0}".format(e))
jedi = None
else:
if isinstance(version, str):
Expand Down Expand Up @@ -574,7 +574,7 @@ def do_rename(replace, orig=None):
if os.path.abspath(vim.current.buffer.name) != r.module_path:
result = new_buffer(r.module_path)
if not result:
echo_highlight("Jedi-vim: failed to create buffer window for {}!".format(r.module_path))
echo_highlight("Jedi-vim: failed to create buffer window for {0}!".format(r.module_path))
continue

buffers.add(vim.current.buffer.name)
Expand All @@ -584,20 +584,20 @@ def do_rename(replace, orig=None):

# Replace original word.
vim.current.window.cursor = r.start_pos
vim_command('normal! c{:d}l{}'.format(len(orig), replace))
vim_command('normal! c{0:d}l{1}'.format(len(orig), replace))

# Restore view.
vim_command('call winrestview(%s)' % saved_view)

# Restore previous tab and window.
vim_command('tabnext {:d}'.format(saved_tab))
vim_command('{:d}wincmd w'.format(saved_win))
vim_command('tabnext {0:d}'.format(saved_tab))
vim_command('{0:d}wincmd w'.format(saved_win))

if len(buffers) > 1:
echo_highlight('Jedi did {:d} renames in {:d} buffers!'.format(
echo_highlight('Jedi did {0:d} renames in {1:d} buffers!'.format(
len(temp_rename), len(buffers)))
else:
echo_highlight('Jedi did {:d} renames!'.format(len(temp_rename)))
echo_highlight('Jedi did {0:d} renames!'.format(len(temp_rename)))


@_check_jedi_availability(show_error=True)
Expand Down

0 comments on commit 625c568

Please sign in to comment.