From 25a39c5f9dd2b761fee06391e19d160e56f0f610 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Linse?= Date: Mon, 31 Oct 2016 10:24:17 +0100 Subject: [PATCH] remove python 2.6 support --- .scrutinizer.yml | 2 +- .travis.yml | 1 - README.md | 2 ++ neovim/__init__.py | 2 +- neovim/api/nvim.py | 2 +- neovim/msgpack_rpc/event_loop/base.py | 4 ++-- neovim/msgpack_rpc/event_loop/uv.py | 4 ++-- neovim/msgpack_rpc/session.py | 6 +++--- neovim/plugin/decorators.py | 6 +++--- neovim/plugin/host.py | 10 +++++----- 10 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index ab17321e..ec087900 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -131,4 +131,4 @@ filter: tools: external_code_coverage: timeout: 1200 - runs: 6 + runs: 5 diff --git a/.travis.yml b/.travis.yml index 6a731c3c..982089fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,6 @@ matrix: 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 --git a/README.md b/README.md index 97f9dbc7..555f78c1 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ connecting to and scripting Nvim processes through its msgpack-rpc API. #### Installation +Supports python 2.7, and 3.3 or later. + ```sh pip2 install neovim pip3 install neovim diff --git a/neovim/__init__.py b/neovim/__init__.py index a25b3035..35e53533 100644 --- a/neovim/__init__.py +++ b/neovim/__init__.py @@ -118,7 +118,7 @@ def setup_logging(name): 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 --git a/neovim/api/nvim.py b/neovim/api/nvim.py index e93da598..3d8ee8e5 100644 --- a/neovim/api/nvim.py +++ b/neovim/api/nvim.py @@ -341,7 +341,7 @@ def handler(): 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}" + "{!r}\n{}\n \nthe call was requested at\n{}" .format(err, format_exc_skip(1, 5), call_point)) self._err_cb(msg) raise diff --git a/neovim/msgpack_rpc/event_loop/base.py b/neovim/msgpack_rpc/event_loop/base.py index a05299e9..2f27bd4b 100644 --- a/neovim/msgpack_rpc/event_loop/base.py +++ b/neovim/msgpack_rpc/event_loop/base.py @@ -85,7 +85,7 @@ def __init__(self, transport_type, *args): 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 @@ def stop(self): 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 --git a/neovim/msgpack_rpc/event_loop/uv.py b/neovim/msgpack_rpc/event_loop/uv.py index 73daab42..449d28ea 100644 --- a/neovim/msgpack_rpc/event_loop/uv.py +++ b/neovim/msgpack_rpc/event_loop/uv.py @@ -21,7 +21,7 @@ def _init(self): 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 _disconnected(self, *args): 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 --git a/neovim/msgpack_rpc/session.py b/neovim/msgpack_rpc/session.py index e2a49946..de87c976 100644 --- a/neovim/msgpack_rpc/session.py +++ b/neovim/msgpack_rpc/session.py @@ -82,7 +82,7 @@ def request(self, method, *args, **kwargs): 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 @@ def on_setup(): 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 --git a/neovim/plugin/decorators.py b/neovim/plugin/decorators.py index acbf0bed..defceb3b 100644 --- a/neovim/plugin/decorators.py +++ b/neovim/plugin/decorators.py @@ -46,7 +46,7 @@ def command(name, nargs=0, complete=None, range=None, count=None, bang=False, 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 dec(f): 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 dec(f): 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 --git a/neovim/plugin/host.py b/neovim/plugin/host.py index 6769ef69..ff1d1f70 100644 --- a/neovim/plugin/host.py +++ b/neovim/plugin/host.py @@ -120,7 +120,7 @@ def _load(self, plugins): 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 @@ def _load(self, plugins): 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 @@ def predicate(o): 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 @@ def predicate(o): # 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'):