Hello community, here is the log from the commit of package python-neovim for openSUSE:Factory checked in at 2016-11-18 22:02:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-neovim (Old) and /work/SRC/openSUSE:Factory/.python-neovim.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-neovim" Changes: -------- --- /work/SRC/openSUSE:Factory/python-neovim/python-neovim.changes 2016-10-10 16:25:00.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-neovim.new/python-neovim.changes 2016-11-18 22:02:26.000000000 +0100 @@ -1,0 +2,18 @@ +Thu Nov 17 16:32:28 UTC 2016 - [email protected] + +- Add neovim as a runtime dependency, since there is no reason to + install this package without neovim and the new version will only + work with neovim >= 0.1.6. +- Version bump to 0.1.11. + Upstream changelog: + + Version 0.1.11 + + * ce840cb Add number attribute to Window and Tabpage objects + * 111bc07 Use api level 1, as released with nvim 0.1.6. + * ba1fcd4 add neovim.VERSION (python module version) and + nvim.version attributes. + * 6eb75a3 show full tracebacks for errors in handlers and + callbacks + +------------------------------------------------------------------- python3-neovim.changes: same change Old: ---- python-client-0.1.10.tar.gz New: ---- python-client-0.1.11.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-neovim.spec ++++++ --- /var/tmp/diff_new_pack.5hfaD2/_old 2016-11-18 22:02:27.000000000 +0100 +++ /var/tmp/diff_new_pack.5hfaD2/_new 2016-11-18 22:02:27.000000000 +0100 @@ -17,7 +17,7 @@ Name: python-neovim -Version: 0.1.10 +Version: 0.1.11 Release: 0 Summary: Python 2 client to Neovim License: Apache-2.0 @@ -25,8 +25,9 @@ Url: https://github.com/neovim/python-client Source: https://github.com/neovim/python-client/archive/%{version}/python-client-%{version}.tar.gz BuildRequires: fdupes -BuildRequires: python-devel +BuildRequires: python-devel >= 2.7 BuildRequires: python-setuptools +Requires: neovim >= 0.1.6 Requires: python-greenlet Requires: python-msgpack-python Requires: python-trollius ++++++ python3-neovim.spec ++++++ --- /var/tmp/diff_new_pack.5hfaD2/_old 2016-11-18 22:02:27.000000000 +0100 +++ /var/tmp/diff_new_pack.5hfaD2/_new 2016-11-18 22:02:27.000000000 +0100 @@ -17,7 +17,7 @@ Name: python3-neovim -Version: 0.1.10 +Version: 0.1.11 Release: 0 Summary: Python 3 client to Neovim License: Apache-2.0 @@ -25,8 +25,9 @@ Url: https://github.com/neovim/python-client Source: https://github.com/neovim/python-client/archive/%{version}/python-client-%{version}.tar.gz BuildRequires: fdupes -BuildRequires: python3-devel +BuildRequires: python3-devel >= 3.3 BuildRequires: python3-setuptools +Requires: neovim >= 0.1.6 Requires: python3-greenlet Requires: python3-msgpack-python BuildArch: noarch ++++++ python-client-0.1.10.tar.gz -> python-client-0.1.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/.scrutinizer.yml new/python-client-0.1.11/.scrutinizer.yml --- old/python-client-0.1.10/.scrutinizer.yml 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/.scrutinizer.yml 2016-11-08 16:07:50.000000000 +0100 @@ -131,4 +131,4 @@ tools: external_code_coverage: timeout: 1200 - runs: 6 + runs: 5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/.travis.yml new/python-client-0.1.11/.travis.yml --- old/python-client-0.1.10/.travis.yml 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/.travis.yml 2016-11-08 16:07:50.000000000 +0100 @@ -17,7 +17,6 @@ python: # If the build matrix gets bigger, also update the number of runs # at the bottom of .scrutinizer.yml. - - 2.6 - 2.7 - 3.3 - 3.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/README.md new/python-client-0.1.11/README.md --- old/python-client-0.1.10/README.md 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/README.md 2016-11-08 16:07:50.000000000 +0100 @@ -9,6 +9,8 @@ #### Installation +Supports python 2.7, and 3.3 or later. + ```sh pip2 install neovim pip3 install neovim diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/__init__.py new/python-client-0.1.11/neovim/__init__.py --- old/python-client-0.1.10/neovim/__init__.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/__init__.py 2016-11-08 16:07:50.000000000 +0100 @@ -12,14 +12,18 @@ stdio_session, tcp_session) from .plugin import (Host, autocmd, command, decode, encoding, function, plugin, rpc_export, shutdown_hook) +from .util import Version __all__ = ('tcp_session', 'socket_session', 'stdio_session', 'child_session', 'start_host', 'autocmd', 'command', 'encoding', 'decode', - 'function', 'plugin', 'rpc_export', 'Host', 'Nvim', + 'function', 'plugin', 'rpc_export', 'Host', 'Nvim', 'VERSION', 'shutdown_hook', 'attach', 'setup_logging', 'ErrorResponse') +VERSION = Version(major=0, minor=1, patch=11, prerelease="dev") + + def start_host(session=None): """Promote the current process into python plugin host for Nvim. @@ -64,7 +68,14 @@ if not session: session = stdio_session() - host = Host(Nvim.from_session(session)) + nvim = Nvim.from_session(session) + + if nvim.version.api_level < 1: + sys.stderr.write("This version of the neovim python package " + "requires nvim 0.1.6 or later") + sys.exit(1) + + host = Host(nvim) host.start(plugins) @@ -107,7 +118,7 @@ if 'NVIM_PYTHON_LOG_FILE' in os.environ: prefix = os.environ['NVIM_PYTHON_LOG_FILE'].strip() major_version = sys.version_info[0] - logfile = '{0}_py{1}_{2}'.format(prefix, major_version, name) + logfile = '{}_py{}_{}'.format(prefix, major_version, name) handler = logging.FileHandler(logfile, 'w') handler.formatter = logging.Formatter( '%(asctime)s [%(levelname)s @ ' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/api/buffer.py new/python-client-0.1.11/neovim/api/buffer.py --- old/python-client-0.1.10/neovim/api/buffer.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/api/buffer.py 2016-11-08 16:07:50.000000000 +0100 @@ -10,11 +10,21 @@ basestring = str +def adjust_index(idx, default=None): + """Convert from python indexing convention to nvim indexing convention.""" + if idx is None: + return default + elif idx < 0: + return idx - 1 + else: + return idx + + class Buffer(Remote): """A remote Nvim buffer.""" - _api_prefix = "buffer_" + _api_prefix = "nvim_buf_" def __len__(self): """Return the number of lines contained in a Buffer.""" @@ -31,19 +41,13 @@ the whole buffer. """ if not isinstance(idx, slice): - return self._session.request('buffer_get_line', self, idx) - include_end = False - start = idx.start - end = idx.stop - if start is None: - start = 0 - if end is None: - end = -1 - include_end = True - return self._session.request('buffer_get_line_slice', self, start, end, - True, include_end) + i = adjust_index(idx) + return self.request('nvim_buf_get_lines', i, i + 1, True)[0] + start = adjust_index(idx.start, 0) + end = adjust_index(idx.stop, -1) + return self.request('nvim_buf_get_lines', start, end, False) - def __setitem__(self, idx, lines): + def __setitem__(self, idx, item): """Replace a buffer line or slice by integer index. Like with `__getitem__`, indexes may be negative. @@ -52,23 +56,13 @@ the whole buffer. """ if not isinstance(idx, slice): - if lines is None: - return self._session.request('buffer_del_line', self, idx) - else: - return self._session.request('buffer_set_line', self, idx, - lines) - if lines is None: - lines = [] - include_end = False - start = idx.start - end = idx.stop - if start is None: - start = 0 - if end is None: - end = -1 - include_end = True - return self._session.request('buffer_set_line_slice', self, start, end, - True, include_end, lines) + i = adjust_index(idx) + lines = [item] if item is not None else [] + return self.request('nvim_buf_set_lines', i, i + 1, True, lines) + lines = item if item is not None else [] + start = adjust_index(idx.start, 0) + end = adjust_index(idx.stop, -1) + return self.request('buffer_set_lines', start, end, False, lines) def __iter__(self): """Iterate lines of a buffer. @@ -87,30 +81,17 @@ This is the same as __setitem__(idx, []) """ - if not isinstance(idx, slice): - self.__setitem__(idx, None) - else: - self.__setitem__(idx, []) - - def get_line_slice(self, start, stop, start_incl, end_incl): - """More flexible wrapper for retrieving slices.""" - return self._session.request('buffer_get_line_slice', self, start, - stop, start_incl, end_incl) - - def set_line_slice(self, start, stop, start_incl, end_incl, lines): - """More flexible wrapper for replacing slices.""" - return self._session.request('buffer_set_line_slice', self, start, - stop, start_incl, end_incl, lines) + self.__setitem__(idx, None) def append(self, lines, index=-1): """Append a string or list of lines to the buffer.""" if isinstance(lines, (basestring, bytes)): lines = [lines] - return self._session.request('buffer_insert', self, index, lines) + return self.request('nvim_buf_set_lines', index, index, True, lines) def mark(self, name): """Return (row, col) tuple for a named mark.""" - return self.request('buffer_get_mark', name) + return self.request('nvim_buf_get_mark', name) def range(self, start, end): """Return a `Range` object, which represents part of the Buffer.""" @@ -121,33 +102,33 @@ """Add a highlight to the buffer.""" if async is None: async = (src_id != 0) - return self.request('buffer_add_highlight', src_id, hl_group, + return self.request('nvim_buf_add_highlight', src_id, hl_group, line, col_start, col_end, async=async) def clear_highlight(self, src_id, line_start=0, line_end=-1, async=True): """Clear highlights from the buffer.""" - self.request('buffer_clear_highlight', src_id, + self.request('nvim_buf_clear_highlight', src_id, line_start, line_end, async=async) @property def name(self): """Get the buffer name.""" - return self.request('buffer_get_name') + return self.request('nvim_buf_get_name') @name.setter def name(self, value): """Set the buffer name. BufFilePre/BufFilePost are triggered.""" - return self.request('buffer_set_name', value) + return self.request('nvim_buf_set_name', value) @property def valid(self): """Return True if the buffer still exists.""" - return self.request('buffer_is_valid') + return self.request('nvim_buf_is_valid') @property def number(self): """Get the buffer number.""" - return self.request('buffer_get_number') + return self.request('nvim_buf_get_number') class Range(object): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/api/nvim.py new/python-client-0.1.11/neovim/api/nvim.py --- old/python-client-0.1.10/neovim/api/nvim.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/api/nvim.py 2016-11-08 16:07:50.000000000 +0100 @@ -13,7 +13,7 @@ from .tabpage import Tabpage from .window import Window from ..compat import IS_PYTHON3 -from ..util import format_exc_skip +from ..util import Version, format_exc_skip __all__ = ('Nvim') @@ -74,14 +74,16 @@ self._session = session self.channel_id = channel_id self.metadata = metadata + version = metadata.get("version", {"api_level": 0}) + self.version = Version(**version) self.types = types - self.api = RemoteApi(self, 'vim_') - self.vars = RemoteMap(self, 'vim_get_var', 'vim_set_var') + self.api = RemoteApi(self, 'nvim_') + self.vars = RemoteMap(self, 'nvim_get_var', 'nvim_set_var') self.vvars = RemoteMap(self, 'vim_get_vvar', None) - self.options = RemoteMap(self, 'vim_get_option', 'vim_set_option') + self.options = RemoteMap(self, 'nvim_get_option', 'nvim_set_option') self.buffers = Buffers(self) - self.windows = RemoteSequence(self, 'vim_get_windows') - self.tabpages = RemoteSequence(self, 'vim_get_tabpages') + self.windows = RemoteSequence(self, 'nvim_list_wins') + self.tabpages = RemoteSequence(self, 'nvim_list_tabpages') self.current = Current(self) self.session = CompatibilitySession(self) self.funcs = Funcs(self) @@ -116,8 +118,8 @@ is equivalent to - vim.request('vim_err_write', 'ERROR\n', async=True) - vim.request('buffer_get_mark', vim.current.buffer, '.') + vim.request('nvim_err_write', 'ERROR\n', async=True) + vim.request('nvim_buf_get_mark', vim.current.buffer, '.') Normally a blocking request will be sent. If the `async` flag is @@ -157,7 +159,7 @@ result = request_cb(name, args) except Exception: msg = ("error caught in request handler '{} {}'\n{}\n\n" - .format(name, args, format_exc_skip(1, 5))) + .format(name, args, format_exc_skip(1))) self._err_cb(msg) raise return walk(self._to_nvim, result) @@ -169,7 +171,7 @@ notification_cb(name, args) except Exception: msg = ("error caught in notification handler '{} {}'\n{}\n\n" - .format(name, args, format_exc_skip(1, 5))) + .format(name, args, format_exc_skip(1))) self._err_cb(msg) raise @@ -205,38 +207,38 @@ def subscribe(self, event): """Subscribe to a Nvim event.""" - return self.request('vim_subscribe', event) + return self.request('nvim_subscribe', event) def unsubscribe(self, event): """Unsubscribe to a Nvim event.""" - return self.request('vim_unsubscribe', event) + return self.request('nvim_unsubscribe', event) def command(self, string, **kwargs): """Execute a single ex command.""" - return self.request('vim_command', string, **kwargs) + return self.request('nvim_command', string, **kwargs) def command_output(self, string): """Execute a single ex command and return the output.""" - return self.request('vim_command_output', string) + return self.request('nvim_command_output', string) def eval(self, string, **kwargs): """Evaluate a vimscript expression.""" - return self.request('vim_eval', string, **kwargs) + return self.request('nvim_eval', string, **kwargs) def call(self, name, *args, **kwargs): """Call a vimscript function.""" - return self.request('vim_call_function', name, args, **kwargs) + return self.request('nvim_call_function', name, args, **kwargs) def strwidth(self, string): """Return the number of display cells `string` occupies. Tab is counted as one cell. """ - return self.request('vim_strwidth', string) + return self.request('nvim_strwidth', string) def list_runtime_paths(self): """Return a list of paths contained in the 'runtimepath' option.""" - return self.request('vim_list_runtime_paths') + return self.request('nvim_list_runtime_paths') def foreach_rtp(self, cb): """Invoke `cb` for each path in 'runtimepath'. @@ -246,7 +248,7 @@ are no longer paths. If stopped in case callable returned non-None, vim.foreach_rtp function returns the value returned by callable. """ - for path in self.request('vim_list_runtime_paths'): + for path in self.request('nvim_list_runtime_paths'): try: if cb(path) is not None: break @@ -256,7 +258,7 @@ def chdir(self, dir_path): """Run os.chdir, then all appropriate vim stuff.""" os_chdir(dir_path) - return self.request('vim_change_directory', dir_path) + return self.request('nvim_set_current_dir', dir_path) def feedkeys(self, keys, options='', escape_csi=True): """Push `keys` to Nvim user input buffer. @@ -267,7 +269,7 @@ - 't': Handle keys as if typed; otherwise they are handled as if coming from a mapping. This matters for undo, opening folds, etc. """ - return self.request('vim_feedkeys', keys, options, escape_csi) + return self.request('nvim_feedkeys', keys, options, escape_csi) def input(self, bytes): """Push `bytes` to Nvim low level input buffer. @@ -277,7 +279,7 @@ written(which can be less than what was requested if the buffer is full). """ - return self.request('vim_input', bytes) + return self.request('nvim_input', bytes) def replace_termcodes(self, string, from_part=False, do_lt=True, special=True): @@ -298,11 +300,11 @@ def out_write(self, msg): """Print `msg` as a normal message.""" - return self.request('vim_out_write', msg) + return self.request('nvim_out_write', msg) def err_write(self, msg, **kwargs): """Print `msg` as an error message.""" - return self.request('vim_err_write', msg, **kwargs) + return self.request('nvim_err_write', msg, **kwargs) def quit(self, quit_command='qa!'): """Send a quit command to Nvim. @@ -339,8 +341,8 @@ fn(*args, **kwargs) except Exception as err: msg = ("error caught while executing async callback:\n" - "{0!r}\n{1}\n \nthe call was requested at\n{2}" - .format(err, format_exc_skip(1, 5), call_point)) + "{!r}\n{}\n \nthe call was requested at\n{}" + .format(err, format_exc_skip(1), call_point)) self._err_cb(msg) raise self._session.threadsafe_call(handler) @@ -359,7 +361,7 @@ def __init__(self, nvim): """Initialize a Buffers object with Nvim object `nvim`.""" - self._fetch_buffers = nvim.api.get_buffers + self._fetch_buffers = nvim.api.list_bufs def __len__(self): """Return the count of buffers.""" @@ -399,35 +401,35 @@ @property def line(self): - return self._session.request('vim_get_current_line') + return self._session.request('nvim_get_current_line') @line.setter def line(self, line): - return self._session.request('vim_set_current_line', line) + return self._session.request('nvim_set_current_line', line) @property def buffer(self): - return self._session.request('vim_get_current_buffer') + return self._session.request('nvim_get_current_buf') @buffer.setter def buffer(self, buffer): - return self._session.request('vim_set_current_buffer', buffer) + return self._session.request('nvim_set_current_buf', buffer) @property def window(self): - return self._session.request('vim_get_current_window') + return self._session.request('nvim_get_current_win') @window.setter def window(self, window): - return self._session.request('vim_set_current_window', window) + return self._session.request('nvim_set_current_win', window) @property def tabpage(self): - return self._session.request('vim_get_current_tabpage') + return self._session.request('nvim_get_current_tabpage') @tabpage.setter def tabpage(self, tabpage): - return self._session.request('vim_set_current_tabpage', tabpage) + return self._session.request('nvim_set_current_tabpage', tabpage) class Funcs(object): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/api/tabpage.py new/python-client-0.1.11/neovim/api/tabpage.py --- old/python-client-0.1.10/neovim/api/tabpage.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/api/tabpage.py 2016-11-08 16:07:50.000000000 +0100 @@ -8,7 +8,7 @@ class Tabpage(Remote): """A remote Nvim tabpage.""" - _api_prefix = "tabpage_" + _api_prefix = "nvim_tabpage_" def __init__(self, *args): """Initialize from session and code_data immutable object. @@ -17,14 +17,19 @@ msgpack-rpc calls. It must be immutable for Buffer equality to work. """ super(Tabpage, self).__init__(*args) - self.windows = RemoteSequence(self, 'tabpage_get_windows') + self.windows = RemoteSequence(self, 'nvim_tabpage_list_wins') @property def window(self): """Get the `Window` currently focused on the tabpage.""" - return self.request('tabpage_get_window') + return self.request('nvim_tabpage_get_win') @property def valid(self): """Return True if the tabpage still exists.""" - return self.request('tabpage_is_valid') + return self.request('nvim_tabpage_is_valid') + + @property + def number(self): + """Get the tabpage number.""" + return self.request('nvim_tabpage_get_number') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/api/window.py new/python-client-0.1.11/neovim/api/window.py --- old/python-client-0.1.10/neovim/api/window.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/api/window.py 2016-11-08 16:07:50.000000000 +0100 @@ -9,59 +9,64 @@ """A remote Nvim window.""" - _api_prefix = "window_" + _api_prefix = "nvim_win_" @property def buffer(self): """Get the `Buffer` currently being displayed by the window.""" - return self.request('window_get_buffer') + return self.request('nvim_win_get_buf') @property def cursor(self): """Get the (row, col) tuple with the current cursor position.""" - return self.request('window_get_cursor') + return self.request('nvim_win_get_cursor') @cursor.setter def cursor(self, pos): """Set the (row, col) tuple as the new cursor position.""" - return self.request('window_set_cursor', pos) + return self.request('nvim_win_set_cursor', pos) @property def height(self): """Get the window height in rows.""" - return self.request('window_get_height') + return self.request('nvim_win_get_height') @height.setter def height(self, height): """Set the window height in rows.""" - return self.request('window_set_height', height) + return self.request('nvim_win_set_height', height) @property def width(self): """Get the window width in rows.""" - return self.request('window_get_width') + return self.request('nvim_win_get_width') @width.setter def width(self, width): """Set the window height in rows.""" - return self.request('window_set_width', width) + return self.request('nvim_win_set_width', width) @property def row(self): """0-indexed, on-screen window position(row) in display cells.""" - return self.request('window_get_position')[0] + return self.request('nvim_win_get_position')[0] @property def col(self): """0-indexed, on-screen window position(col) in display cells.""" - return self.request('window_get_position')[1] + return self.request('nvim_win_get_position')[1] @property def tabpage(self): """Get the `Tabpage` that contains the window.""" - return self.request('window_get_tabpage') + return self.request('nvim_win_get_tabpage') @property def valid(self): """Return True if the window still exists.""" - return self.request('window_is_valid') + return self.request('nvim_win_is_valid') + + @property + def number(self): + """Get the window number.""" + return self.request('nvim_win_get_number') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/msgpack_rpc/event_loop/base.py new/python-client-0.1.11/neovim/msgpack_rpc/event_loop/base.py --- old/python-client-0.1.10/neovim/msgpack_rpc/event_loop/base.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/msgpack_rpc/event_loop/base.py 2016-11-08 16:07:50.000000000 +0100 @@ -85,7 +85,7 @@ self._on_data = None self._error = None self._init() - getattr(self, '_connect_{0}'.format(transport_type))(*args) + getattr(self, '_connect_{}'.format(transport_type))(*args) self._start_reading() def connect_tcp(self, address, port): @@ -149,7 +149,7 @@ debug('Stopped event loop') def _on_signal(self, signum): - msg = 'Received {0}'.format(self._signames[signum]) + msg = 'Received {}'.format(self._signames[signum]) debug(msg) if signum == signal.SIGINT and self._transport_type == 'stdio': # When the transport is stdio, we are probably running as a Nvim diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/msgpack_rpc/event_loop/uv.py new/python-client-0.1.11/neovim/msgpack_rpc/event_loop/uv.py --- old/python-client-0.1.10/neovim/msgpack_rpc/event_loop/uv.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/msgpack_rpc/event_loop/uv.py 2016-11-08 16:07:50.000000000 +0100 @@ -21,7 +21,7 @@ def _on_connect(self, stream, error): self.stop() if error: - msg = 'Cannot connect to {0}: {1}'.format( + msg = 'Cannot connect to {}: {}'.format( self._connect_address, pyuv.errno.strerror(error)) self._connection_error = IOError(msg) return @@ -49,7 +49,7 @@ def _connect_tcp(self, address, port): stream = pyuv.TCP(self._loop) - self._connect_address = '{0}:{1}'.format(address, port) + self._connect_address = '{}:{}'.format(address, port) stream.connect((address, port), self._on_connect) def _connect_socket(self, path): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/msgpack_rpc/session.py new/python-client-0.1.11/neovim/msgpack_rpc/session.py --- old/python-client-0.1.10/neovim/msgpack_rpc/session.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/msgpack_rpc/session.py 2016-11-08 16:07:50.000000000 +0100 @@ -82,7 +82,7 @@ return if kwargs: - raise ValueError("request got unsupported keyword argument(s): {0}" + raise ValueError("request got unsupported keyword argument(s): {}" .format(', '.join(kwargs.keys()))) if self._is_running: @@ -122,13 +122,13 @@ gr.switch() if self._setup_exception: - error('Setup error: {0}'.format(self._setup_exception)) + error('Setup error: {}'.format(self._setup_exception)) raise self._setup_exception # Process all pending requests and notifications while self._pending_messages: msg = self._pending_messages.popleft() - getattr(self, '_on_{0}'.format(msg[0]))(*msg[1:]) + getattr(self, '_on_{}'.format(msg[0]))(*msg[1:]) self._async_session.run(self._on_request, self._on_notification) self._is_running = False self._request_cb = None diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/plugin/decorators.py new/python-client-0.1.11/neovim/plugin/decorators.py --- old/python-client-0.1.10/neovim/plugin/decorators.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/plugin/decorators.py 2016-11-08 16:07:50.000000000 +0100 @@ -46,7 +46,7 @@ register=False, sync=False, eval=None): """Tag a function or plugin method as a Nvim command handler.""" def dec(f): - f._nvim_rpc_method_name = 'command:{0}'.format(name) + f._nvim_rpc_method_name = 'command:{}'.format(name) f._nvim_rpc_sync = sync f._nvim_bind = True f._nvim_prefix_plugin_path = True @@ -86,7 +86,7 @@ def autocmd(name, pattern='*', sync=False, eval=None): """Tag a function or plugin method as a Nvim autocommand handler.""" def dec(f): - f._nvim_rpc_method_name = 'autocmd:{0}:{1}'.format(name, pattern) + f._nvim_rpc_method_name = 'autocmd:{}:{}'.format(name, pattern) f._nvim_rpc_sync = sync f._nvim_bind = True f._nvim_prefix_plugin_path = True @@ -111,7 +111,7 @@ def function(name, range=False, sync=False, eval=None): """Tag a function or plugin method as a Nvim function handler.""" def dec(f): - f._nvim_rpc_method_name = 'function:{0}'.format(name) + f._nvim_rpc_method_name = 'function:{}'.format(name) f._nvim_rpc_sync = sync f._nvim_bind = True f._nvim_prefix_plugin_path = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/plugin/host.py new/python-client-0.1.11/neovim/plugin/host.py --- old/python-client-0.1.10/neovim/plugin/host.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/plugin/host.py 2016-11-08 16:07:50.000000000 +0100 @@ -71,11 +71,11 @@ except Exception: if sync: msg = ("error caught in request handler '{} {}':\n{}" - .format(name, args, format_exc_skip(1, 5))) + .format(name, args, format_exc_skip(1))) raise ErrorResponse(msg) else: msg = ("error caught in async handler '{} {}'\n{}\n" - .format(name, args, format_exc_skip(1, 5))) + .format(name, args, format_exc_skip(1))) self._on_async_err(msg + "\n") def _on_request(self, name, args): @@ -120,7 +120,7 @@ for path in plugins: err = None if path in self._loaded: - error('{0} is already loaded'.format(path)) + error('{} is already loaded'.format(path)) continue try: if path == "script_host.py": @@ -133,7 +133,7 @@ self._discover_classes(module, handlers, path) self._discover_functions(module, handlers, path) if not handlers: - error('{0} exports no handlers'.format(path)) + error('{} exports no handlers'.format(path)) continue self._loaded[path] = {'handlers': handlers, 'module': module} except Exception as e: @@ -179,7 +179,7 @@ method = fn._nvim_rpc_method_name if fn._nvim_prefix_plugin_path: - method = '{0}:{1}'.format(plugin_path, method) + method = '{}:{}'.format(plugin_path, method) fn_wrapped = functools.partial(self._wrap_function, fn, sync, decode, nvim_bind, method) @@ -187,12 +187,12 @@ # register in the rpc handler dict if sync: if method in self._request_handlers: - raise Exception(('Request handler for "{0}" is ' + + raise Exception(('Request handler for "{}" is ' + 'already registered').format(method)) self._request_handlers[method] = fn_wrapped else: if method in self._notification_handlers: - raise Exception(('Notification handler for "{0}" is ' + + raise Exception(('Notification handler for "{}" is ' + 'already registered').format(method)) self._notification_handlers[method] = fn_wrapped if hasattr(fn, '_nvim_rpc_spec'): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/plugin/script_host.py new/python-client-0.1.11/neovim/plugin/script_host.py --- old/python-client-0.1.10/neovim/plugin/script_host.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/plugin/script_host.py 2016-11-08 16:07:50.000000000 +0100 @@ -96,7 +96,6 @@ self._set_current_range(start, stop) nvim = self.nvim start -= 1 - stop -= 1 fname = '_vim_pydo' # define the function @@ -104,15 +103,14 @@ exec(function_def, self.module.__dict__) # get the function function = self.module.__dict__[fname] - while start <= stop: + while start < stop: # Process batches of 5000 to avoid the overhead of making multiple # API calls for every line. Assuming an average line length of 100 # bytes, approximately 488 kilobytes will be transferred per batch, # which can be done very quickly in a single API call. sstart = start sstop = min(start + 5000, stop) - lines = nvim.current.buffer.get_line_slice(sstart, sstop, True, - True) + lines = nvim.current.buffer.api.get_lines(sstart, sstop, True) exception = None newlines = [] @@ -123,9 +121,8 @@ # Update earlier lines, and skip to the next if newlines: end = sstart + len(newlines) - 1 - nvim.current.buffer.set_line_slice(sstart, end, - True, True, - newlines) + nvim.current.buffer.api.set_lines(sstart, end, + True, newlines) sstart += len(newlines) + 1 newlines = [] pass @@ -138,11 +135,10 @@ break linenr += 1 - start = sstop + 1 + start = sstop if newlines: - end = sstart + len(newlines) - 1 - nvim.current.buffer.set_line_slice(sstart, end, True, True, - newlines) + end = sstart + len(newlines) + nvim.current.buffer.api.set_lines(sstart, end, True, newlines) if exception: raise exception # delete the function diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/neovim/util.py new/python-client-0.1.11/neovim/util.py --- old/python-client-0.1.10/neovim/util.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/neovim/util.py 2016-11-08 16:07:50.000000000 +0100 @@ -10,3 +10,23 @@ for i in range(skip): tb = tb.tb_next return ('\n'.join(format_exception(type, val, tb, limit))).rstrip() + + +# Taken from SimpleNamespace in python 3 +class Version: + + """Helper class for version info.""" + + def __init__(self, **kwargs): + """Create the Version object.""" + self.__dict__.update(kwargs) + + def __repr__(self): + """Return str representation of the Version.""" + keys = sorted(self.__dict__) + items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys) + return "{}({})".format(type(self).__name__, ", ".join(items)) + + def __eq__(self, other): + """Check if version is same as other.""" + return self.__dict__ == other.__dict__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/setup.py new/python-client-0.1.11/setup.py --- old/python-client-0.1.10/setup.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/setup.py 2016-11-08 16:07:50.000000000 +0100 @@ -19,7 +19,7 @@ install_requires.append('greenlet') setup(name='neovim', - version='0.1.10', + version='0.1.11', description='Python client to neovim', url='http://github.com/neovim/python-client', download_url='https://github.com/neovim/python-client/archive/0.1.10.tar.gz', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/test/test_buffer.py new/python-client-0.1.11/test/test_buffer.py --- old/python-client-0.1.10/test/test_buffer.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/test/test_buffer.py 2016-11-08 16:07:50.000000000 +0100 @@ -83,8 +83,8 @@ vim.current.buffer.api.set_var('myvar', 'thetext') eq(vim.current.buffer.api.get_var('myvar'), 'thetext') eq(vim.eval('b:myvar'), 'thetext') - vim.current.buffer.api.set_line_slice(0,-1,True,True,['alpha', 'beta']) - eq(vim.current.buffer.api.get_line_slice(0,-1,True,True), ['alpha', 'beta']) + vim.current.buffer.api.set_lines(0,-1,True,['alpha', 'beta']) + eq(vim.current.buffer.api.get_lines(0,-1,True), ['alpha', 'beta']) eq(vim.current.buffer[:], ['alpha', 'beta']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/test/test_tabpage.py new/python-client-0.1.11/test/test_tabpage.py --- old/python-client-0.1.10/test/test_tabpage.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/test/test_tabpage.py 2016-11-08 16:07:50.000000000 +0100 @@ -28,3 +28,12 @@ ok(tabpage.valid) vim.command('tabclose') ok(not tabpage.valid) + + +@with_setup(setup=cleanup) +def test_number(): + curnum = vim.current.tabpage.number + vim.command('tabnew') + eq(vim.current.tabpage.number, curnum + 1) + vim.command('tabnew') + eq(vim.current.tabpage.number, curnum + 2) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-client-0.1.10/test/test_window.py new/python-client-0.1.11/test/test_window.py --- old/python-client-0.1.10/test/test_window.py 2016-09-24 10:09:36.000000000 +0200 +++ new/python-client-0.1.11/test/test_window.py 2016-11-08 16:07:50.000000000 +0100 @@ -94,3 +94,12 @@ ok(window.valid) vim.command('q') ok(not window.valid) + + +@with_setup(setup=cleanup) +def test_number(): + curnum = vim.current.window.number + vim.command('bot split') + eq(vim.current.window.number, curnum + 1) + vim.command('bot split') + eq(vim.current.window.number, curnum + 2)
