[Python-modules-commits] [python-neovim] 01/03: Import python-neovim_0.1.8.orig.tar.gz

Víctor Cuadrado Juan viccuad-guest at moszumanska.debian.org
Thu May 19 22:13:00 UTC 2016


This is an automated email from the git hooks/post-receive script.

viccuad-guest pushed a commit to branch master
in repository python-neovim.

commit c86ff6903b5423d957d0a39cf28f3987cadfb629
Author: Víctor Cuadrado Juan <me at viccuad.me>
Date:   Wed May 18 01:22:01 2016 +0200

    Import python-neovim_0.1.8.orig.tar.gz
---
 PKG-INFO                             |  4 ++--
 neovim.egg-info/PKG-INFO             |  4 ++--
 neovim/__init__.py                   |  3 ---
 neovim/api/common.py                 |  4 +++-
 neovim/compat.py                     |  2 ++
 neovim/msgpack_rpc/msgpack_stream.py |  3 ++-
 neovim/plugin/decorators.py          |  8 ++++----
 neovim/plugin/script_host.py         | 22 +++++++++++++++-------
 setup.py                             |  9 ++++++---
 test/test_buffer.py                  | 11 +++++++++++
 10 files changed, 47 insertions(+), 23 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index defd180..c6d9758 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,11 +1,11 @@
 Metadata-Version: 1.1
 Name: neovim
-Version: 0.1.7
+Version: 0.1.8
 Summary: Python client to neovim
 Home-page: http://github.com/neovim/python-client
 Author: Thiago de Arruda
 Author-email: tpadilha84 at gmail.com
 License: Apache
-Download-URL: https://github.com/neovim/python-client/archive/0.1.7.tar.gz
+Download-URL: https://github.com/neovim/python-client/archive/0.1.8.tar.gz
 Description: UNKNOWN
 Platform: UNKNOWN
diff --git a/neovim.egg-info/PKG-INFO b/neovim.egg-info/PKG-INFO
index defd180..c6d9758 100644
--- a/neovim.egg-info/PKG-INFO
+++ b/neovim.egg-info/PKG-INFO
@@ -1,11 +1,11 @@
 Metadata-Version: 1.1
 Name: neovim
-Version: 0.1.7
+Version: 0.1.8
 Summary: Python client to neovim
 Home-page: http://github.com/neovim/python-client
 Author: Thiago de Arruda
 Author-email: tpadilha84 at gmail.com
 License: Apache
-Download-URL: https://github.com/neovim/python-client/archive/0.1.7.tar.gz
+Download-URL: https://github.com/neovim/python-client/archive/0.1.8.tar.gz
 Description: UNKNOWN
 Platform: UNKNOWN
diff --git a/neovim/__init__.py b/neovim/__init__.py
index 15c7b16..8d12a07 100644
--- a/neovim/__init__.py
+++ b/neovim/__init__.py
@@ -53,9 +53,6 @@ def start_host(session=None):
         if os.path.isdir(path) and dup in plugins:
             plugins.remove(dup)
 
-    if not plugins:
-        sys.exit('must specify at least one plugin as argument')
-
     setup_logging()
 
     if not session:
diff --git a/neovim/api/common.py b/neovim/api/common.py
index eb7da90..33244fd 100644
--- a/neovim/api/common.py
+++ b/neovim/api/common.py
@@ -1,6 +1,8 @@
 """Code shared between the API classes."""
 import functools
 
+from ..compat import unicode_errors_default
+
 
 class Remote(object):
 
@@ -156,7 +158,7 @@ def _identity(obj, session, method, kind):
 def decode_if_bytes(obj, mode=True):
     """Decode obj if it is bytes."""
     if mode is True:
-        mode = "strict"
+        mode = unicode_errors_default
     if isinstance(obj, bytes):
         return obj.decode("utf-8", errors=mode)
     return obj
diff --git a/neovim/compat.py b/neovim/compat.py
index 3a33faf..eac3622 100644
--- a/neovim/compat.py
+++ b/neovim/compat.py
@@ -30,7 +30,9 @@ if IS_PYTHON3:
 
     # There is no 'long' type in Python3 just int
     long = int
+    unicode_errors_default = 'surrogateescape'
 else:
     find_module = original_find_module
+    unicode_errors_default = 'strict'
 
 NUM_TYPES = (int, long, float)
diff --git a/neovim/msgpack_rpc/msgpack_stream.py b/neovim/msgpack_rpc/msgpack_stream.py
index 61d8f87..62f8559 100644
--- a/neovim/msgpack_rpc/msgpack_stream.py
+++ b/neovim/msgpack_rpc/msgpack_stream.py
@@ -3,6 +3,7 @@ import logging
 
 from msgpack import Packer, Unpacker
 
+from ..compat import unicode_errors_default
 
 logger = logging.getLogger(__name__)
 debug, info, warn = (logger.debug, logger.info, logger.warning,)
@@ -19,7 +20,7 @@ class MsgpackStream(object):
     def __init__(self, event_loop):
         """Wrap `event_loop` on a msgpack-aware interface."""
         self._event_loop = event_loop
-        self._packer = Packer(use_bin_type=True)
+        self._packer = Packer(unicode_errors=unicode_errors_default)
         self._unpacker = Unpacker()
         self._message_cb = None
 
diff --git a/neovim/plugin/decorators.py b/neovim/plugin/decorators.py
index 9e4fe4a..acbf0be 100644
--- a/neovim/plugin/decorators.py
+++ b/neovim/plugin/decorators.py
@@ -3,7 +3,7 @@
 import inspect
 import logging
 
-from ..compat import IS_PYTHON3
+from ..compat import IS_PYTHON3, unicode_errors_default
 
 logger = logging.getLogger(__name__)
 debug, info, warn = (logger.debug, logger.info, logger.warning,)
@@ -59,10 +59,10 @@ def command(name, nargs=0, complete=None, range=None, count=None, bang=False,
             opts['count'] = count
 
         if bang:
-            opts['bang'] = True
+            opts['bang'] = ''
 
         if register:
-            opts['register'] = True
+            opts['register'] = ''
 
         if nargs:
             opts['nargs'] = nargs
@@ -141,7 +141,7 @@ def shutdown_hook(f):
     return f
 
 
-def decode(mode='strict'):
+def decode(mode=unicode_errors_default):
     """Configure automatic encoding/decoding of strings."""
     def dec(f):
         f._nvim_decode = mode
diff --git a/neovim/plugin/script_host.py b/neovim/plugin/script_host.py
index d8c5579..78bed76 100644
--- a/neovim/plugin/script_host.py
+++ b/neovim/plugin/script_host.py
@@ -6,7 +6,7 @@ import os
 import sys
 
 from .decorators import plugin, rpc_export
-from ..api import Nvim
+from ..api import Nvim, walk
 
 __all__ = ('ScriptHost',)
 
@@ -161,15 +161,23 @@ class RedirectStream(io.IOBase):
         self.redirect_handler('\n'.join(seq))
 
 
+if IS_PYTHON3:
+    num_types = (int, float)
+else:
+    num_types = (int, long, float)
+
+
+def num_to_str(obj):
+    if isinstance(obj, num_types):
+        return str(obj)
+    else:
+        return obj
+
+
 class LegacyVim(Nvim):
     def eval(self, expr):
         obj = self.request("vim_eval", expr)
-        if IS_PYTHON3:
-            if isinstance(obj, (int, float)):
-                return str(obj)
-        elif isinstance(obj, (int, long, float)):
-            return str(obj)
-        return obj
+        return walk(num_to_str, obj)
 
 
 # This was copied/adapted from nvim-python help
diff --git a/setup.py b/setup.py
index dabc2be..1b8e4f4 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,6 @@
 import platform
 import sys
+import os
 
 from setuptools import setup
 
@@ -7,7 +8,9 @@ install_requires = [
     'msgpack-python>=0.4.0',
 ]
 
-if sys.version_info < (3, 4):
+if os.name == 'nt':
+    install_requires.append('pyuv')
+elif sys.version_info < (3, 4):
     # trollius is just a backport of 3.4 asyncio module
     install_requires.append('trollius')
 
@@ -16,10 +19,10 @@ if platform.python_implementation() != 'PyPy':
     install_requires.append('greenlet')
 
 setup(name='neovim',
-      version='0.1.7',
+      version='0.1.8',
       description='Python client to neovim',
       url='http://github.com/neovim/python-client',
-      download_url='https://github.com/neovim/python-client/archive/0.1.7.tar.gz',
+      download_url='https://github.com/neovim/python-client/archive/0.1.8.tar.gz',
       author='Thiago de Arruda',
       author_email='tpadilha84 at gmail.com',
       license='Apache',
diff --git a/test/test_buffer.py b/test/test_buffer.py
index 43a7c9e..cb863cc 100644
--- a/test/test_buffer.py
+++ b/test/test_buffer.py
@@ -2,6 +2,8 @@ import os
 from nose.tools import with_setup, eq_ as eq, ok_ as ok
 from test_common import vim, cleanup
 
+from neovim.compat import IS_PYTHON3
+
 
 @with_setup(setup=cleanup)
 def test_get_length():
@@ -147,6 +149,15 @@ def test_mark():
     vim.command('mark V')
     eq(vim.current.buffer.mark('V'), [3, 0])
 
+ at with_setup(setup=cleanup)
+def test_invalid_utf8():
+    vim.command('normal "=printf("%c", 0xFF)\np')
+    eq(vim.eval("char2nr(getline(1))"), 0xFF)
+
+    eq(vim.current.buffer[:], ['\udcff'] if IS_PYTHON3 else ['\xff'])
+    vim.current.line += 'x'
+    eq(vim.eval("getline(1)", decode=False), b'\xFFx')
+    eq(vim.current.buffer[:], ['\udcffx'] if IS_PYTHON3 else ['\xffx'])
 
 @with_setup(setup=cleanup)
 def test_get_exceptions():

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-neovim.git



More information about the Python-modules-commits mailing list