Skip to content

Commit 2a0cb3c

Browse files
committed
Fix 'SyntaxError: invalid syntax' on Python 3.7
'async' is keyword in Python 3.7 https://www.python.org/dev/peps/pep-0492/#deprecation-plans
1 parent 70dfc84 commit 2a0cb3c

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

neovim/api/buffer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,17 @@ def range(self, start, end):
9898
return Range(self, start, end)
9999

100100
def add_highlight(self, hl_group, line, col_start=0,
101-
col_end=-1, src_id=-1, async=None):
101+
col_end=-1, src_id=-1, async_=None):
102102
"""Add a highlight to the buffer."""
103-
if async is None:
104-
async = (src_id != 0)
103+
if async_ is None:
104+
async_ = (src_id != 0)
105105
return self.request('nvim_buf_add_highlight', src_id, hl_group,
106-
line, col_start, col_end, async=async)
106+
line, col_start, col_end, async_=async_)
107107

108-
def clear_highlight(self, src_id, line_start=0, line_end=-1, async=True):
108+
def clear_highlight(self, src_id, line_start=0, line_end=-1, async_=True):
109109
"""Clear highlights from the buffer."""
110110
self.request('nvim_buf_clear_highlight', src_id,
111-
line_start, line_end, async=async)
111+
line_start, line_end, async_=async_)
112112

113113
@property
114114
def name(self):

neovim/api/nvim.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,16 @@ def request(self, name, *args, **kwargs):
122122
functions have python wrapper functions. The `api` object can
123123
be also be used to call API functions as methods:
124124
125-
vim.api.err_write('ERROR\n', async=True)
125+
vim.api.err_write('ERROR\n', async_=True)
126126
vim.current.buffer.api.get_mark('.')
127127
128128
is equivalent to
129129
130-
vim.request('nvim_err_write', 'ERROR\n', async=True)
130+
vim.request('nvim_err_write', 'ERROR\n', async_=True)
131131
vim.request('nvim_buf_get_mark', vim.current.buffer, '.')
132132
133133
134-
Normally a blocking request will be sent. If the `async` flag is
134+
Normally a blocking request will be sent. If the `async_` flag is
135135
present and True, a asynchronous notification is sent instead. This
136136
will never block, and the return value or error is ignored.
137137
"""

neovim/msgpack_rpc/session.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ def request(self, method, *args, **kwargs):
7272
- Run the loop until the response is available
7373
- Put requests/notifications received while waiting into a queue
7474
75-
If the `async` flag is present and True, a asynchronous notification is
76-
sent instead. This will never block, and the return value or error is
77-
ignored.
75+
If the `async_` flag is present and True, a asynchronous notification
76+
is sent instead. This will never block, and the return value or error
77+
is ignored.
7878
"""
79-
async = kwargs.pop('async', False)
80-
if async:
79+
async_ = kwargs.pop('async_', False)
80+
if async_:
8181
self._async_session.notify(method, args)
8282
return
8383

neovim/plugin/host.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, nvim):
4646
self._decode_default = IS_PYTHON3
4747

4848
def _on_async_err(self, msg):
49-
self.nvim.err_write(msg, async=True)
49+
self.nvim.err_write(msg, async_=True)
5050

5151
def start(self, plugins):
5252
"""Start listening for msgpack-rpc requests and notifications."""

test/test_client_rpc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def request_cb(name, args):
4444
vim.stop_loop()
4545

4646
# this would have dead-locked if not async
47-
vim.funcs.rpcrequest(vim.channel_id, "test-event", async=True)
47+
vim.funcs.rpcrequest(vim.channel_id, "test-event", async_=True)
4848
vim.run_loop(request_cb, None, None)
4949
eq(vim.vars['result'], 17)
5050

test/test_events.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ def test_receiving_events():
1919
@with_setup(setup=cleanup)
2020
def test_sending_notify():
2121
# notify after notify
22-
vim.command("let g:test = 3", async=True)
22+
vim.command("let g:test = 3", async_=True)
2323
cmd = 'call rpcnotify(%d, "test-event", g:test)' % vim.channel_id
24-
vim.command(cmd, async=True)
24+
vim.command(cmd, async_=True)
2525
event = vim.next_message()
2626
eq(event[1], 'test-event')
2727
eq(event[2], [3])
2828

2929
# request after notify
30-
vim.command("let g:data = 'xyz'", async=True)
30+
vim.command("let g:data = 'xyz'", async_=True)
3131
eq(vim.eval('g:data'), 'xyz')
3232

3333

0 commit comments

Comments
 (0)