Skip to content

Commit dd91aa1

Browse files
committed
Improve python API: Rename spawn --> child.
1 parent 79e4413 commit dd91aa1

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ install:
3636
script:
3737
- if [ $CI_TARGET = tests ]; then
3838
./scripts/run-api-tests.exp "nosetests" "nvim -u NONE";
39-
NVIM_SPAWN_ARGV='["nvim", "-u", "NONE", "--embed"]' nosetests;
39+
NVIM_CHILD_ARGV='["nvim", "-u", "NONE", "--embed"]' nosetests;
4040
else
4141
flake8 neovim;
4242
fi

neovim/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
import sys
88

99
from .api import DecodeHook, Nvim, SessionHook
10-
from .msgpack_rpc import (socket_session, spawn_session, stdio_session,
10+
from .msgpack_rpc import (child_session, socket_session, stdio_session,
1111
tcp_session)
1212
from .plugin import (Host, autocmd, command, encoding, function, plugin,
1313
rpc_export, shutdown_hook)
1414

1515

16-
__all__ = ('tcp_session', 'socket_session', 'stdio_session', 'spawn_session',
16+
__all__ = ('tcp_session', 'socket_session', 'stdio_session', 'child_session',
1717
'start_host', 'autocmd', 'command', 'encoding', 'function',
1818
'plugin', 'rpc_export', 'Host', 'DecodeHook', 'Nvim',
1919
'SessionHook', 'shutdown_hook', 'attach')
@@ -85,7 +85,7 @@ def attach(session_type, address=None, port=None, path=None, argv=None):
8585
session = (tcp_session(address, port) if session_type == 'tcp' else
8686
socket_session(path) if session_type == 'socket' else
8787
stdio_session() if session_type == 'stdio' else
88-
spawn_session(argv) if session_type == 'child'else
88+
child_session(argv) if session_type == 'child'else
8989
None)
9090

9191
if not session:

neovim/msgpack_rpc/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .session import Session
1111

1212

13-
__all__ = ('tcp_session', 'socket_session', 'stdio_session', 'spawn_session')
13+
__all__ = ('tcp_session', 'socket_session', 'stdio_session', 'child_session')
1414

1515

1616
def session(transport_type='stdio', *args, **kwargs):
@@ -36,6 +36,6 @@ def stdio_session():
3636
return session('stdio')
3737

3838

39-
def spawn_session(argv):
39+
def child_session(argv):
4040
"""Create a msgpack-rpc session from a new Nvim instance."""
41-
return session('spawn', argv)
41+
return session('child', argv)

neovim/msgpack_rpc/event_loop/asyncio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def _connect_stdio(self):
8989
coroutine = self._loop.connect_write_pipe(self._fact, sys.stdout)
9090
self._loop.run_until_complete(coroutine)
9191

92-
def _connect_spawn(self, argv):
92+
def _connect_child(self, argv):
9393
coroutine = self._loop.subprocess_exec(self._fact, *argv)
9494
self._loop.run_until_complete(coroutine)
9595

neovim/msgpack_rpc/event_loop/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class BaseEventLoop(object):
3030
- `_connect_socket(path)`: Same as tcp, but use a UNIX domain socket or
3131
or named pipe.
3232
- `_connect_stdio()`: Use stdin/stdout as the connection to Nvim
33-
- `_connect_spawn(argv)`: Use the argument vector `argv` to spawn an
33+
- `_connect_child(argv)`: Use the argument vector `argv` to spawn an
3434
embedded Nvim that has it's stdin/stdout connected to the event loop.
3535
- `_start_reading()`: Called after any of _connect_* methods. Can be used
3636
to perform any post-connection setup or validation.
@@ -68,7 +68,7 @@ def __init__(self, transport_type, *args):
6868
Traceback (most recent call last):
6969
...
7070
AttributeError: 'BaseEventLoop' object has no attribute '_init'
71-
>>> BaseEventLoop('spawn', ['nvim', '--embed', '-u', 'NONE'])
71+
>>> BaseEventLoop('child', ['nvim', '--embed', '-u', 'NONE'])
7272
Traceback (most recent call last):
7373
...
7474
AttributeError: 'BaseEventLoop' object has no attribute '_init'
@@ -101,10 +101,10 @@ def connect_stdio(self):
101101
info('Preparing stdin/stdout for streaming data')
102102
self._connect_stdio()
103103

104-
def connect_spawn(self, argv):
105-
"""Connect a new Nvim instance. Delegated to `_connect_spawn`."""
104+
def connect_child(self, argv):
105+
"""Connect a new Nvim instance. Delegated to `_connect_child`."""
106106
info('Spawning a new nvim instance')
107-
self._connect_spawn(argv)
107+
self._connect_child(argv)
108108

109109
def send(self, data):
110110
"""Queue `data` for sending to Nvim."""

neovim/msgpack_rpc/event_loop/uv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def _connect_stdio(self):
6363
self._write_stream = pyuv.Pipe(self._loop)
6464
self._write_stream.open(sys.stdout.fileno())
6565

66-
def _connect_spawn(self, argv):
66+
def _connect_child(self, argv):
6767
self._write_stream = pyuv.Pipe(self._loop)
6868
self._read_stream = pyuv.Pipe(self._loop)
6969
self._error_stream = pyuv.Pipe(self._loop)

test/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
session = None
1111
vim = None
12-
if 'NVIM_SPAWN_ARGV' in os.environ:
13-
argv = json.loads(os.environ['NVIM_SPAWN_ARGV'])
14-
session = neovim.spawn_session(argv)
12+
if 'NVIM_CHILD_ARGV' in os.environ:
13+
argv = json.loads(os.environ['NVIM_CHILD_ARGV'])
14+
session = neovim.child_session(argv)
1515
else:
1616
session = neovim.socket_session(os.environ['NVIM_LISTEN_ADDRESS'])
1717

0 commit comments

Comments
 (0)