Skip to content

Commit

Permalink
Merge pull request #234 from bfredl/nopy26
Browse files Browse the repository at this point in the history
remove python 2.6 support
  • Loading branch information
bfredl committed Nov 1, 2016
2 parents a5e3d2d + 25a39c5 commit cef445f
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,4 @@ filter:
tools:
external_code_coverage:
timeout: 1200
runs: 6
runs: 5
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion neovim/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 @ '
Expand Down
2 changes: 1 addition & 1 deletion neovim/api/nvim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions neovim/msgpack_rpc/event_loop/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions neovim/msgpack_rpc/event_loop/uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions neovim/msgpack_rpc/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions neovim/plugin/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions neovim/plugin/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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:
Expand Down Expand Up @@ -179,20 +179,20 @@ 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)
self._copy_attributes(fn, fn_wrapped)
# 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'):
Expand Down

0 comments on commit cef445f

Please sign in to comment.