[Python-modules-commits] [python-neovim] 01/04: Imported Upstream version 0.1.3

Víctor Cuadrado Juan viccuad-guest at moszumanska.debian.org
Thu Mar 3 14:03:28 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 f0575df87545a787153bdb6a9335c53d2b435733
Author: Víctor Cuadrado Juan <me at viccuad.me>
Date:   Thu Mar 3 14:01:56 2016 +0100

    Imported Upstream version 0.1.3
---
 .gitignore                            |   7 -
 .scrutinizer.yml                      | 134 --------
 .travis.yml                           |  44 ---
 LICENSE                               | 201 ------------
 PKG-INFO                              |  11 +
 README.md                             |  51 ---
 neovim.egg-info/PKG-INFO              |  11 +
 neovim.egg-info/SOURCES.txt           |  35 ++
 neovim.egg-info/dependency_links.txt  |   1 +
 neovim.egg-info/not-zip-safe          |   1 +
 neovim.egg-info/requires.txt          |   3 +
 neovim.egg-info/top_level.txt         |   1 +
 neovim/__init__.py                    |  42 +--
 neovim/api/nvim.py                    |  29 +-
 neovim/msgpack_rpc/session.py         |   7 +-
 neovim/plugin/host.py                 |  11 +-
 neovim/ui/__init__.py                 |   1 -
 neovim/ui/cli.py                      |  73 -----
 neovim/ui/gtk_ui.py                   | 587 ----------------------------------
 neovim/ui/screen.py                   | 134 --------
 neovim/ui/ui_bridge.py                | 101 ------
 scripts/disable_log_statements.sh     |   4 -
 scripts/enable_log_statements.sh      |   4 -
 scripts/logging_statement_modifier.py | 341 --------------------
 scripts/publish.sh                    |   5 -
 setup.cfg                             |   6 +
 setup.py                              |  28 +-
 test/test_buffer.py                   |   2 +-
 test/test_client_rpc.py               |   2 +-
 test/{common.py => test_common.py}    |   2 +-
 test/test_concurrency.py              |  10 +-
 test/test_events.py                   |   2 +-
 test/test_tabpage.py                  |   2 +-
 test/test_vim.py                      |   2 +-
 test/test_window.py                   |   2 +-
 35 files changed, 154 insertions(+), 1743 deletions(-)

diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 6ea0120..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-*.egg-info/
-__pycache__
-neovim/ui/screen.c
-neovim/ui/screen.so
-build/
-dist/
-*.pyc
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
deleted file mode 100644
index ab17321..0000000
--- a/.scrutinizer.yml
+++ /dev/null
@@ -1,134 +0,0 @@
-checks:
-  python:
-    imports_relative_import: true
-    imports_wildcard_import: true
-    classes_no_self_argument: true
-    classes_bad_mcs_method_argument: true
-    classes_bad_classmethod_argument: true
-    code_rating: true
-    duplicate_code: true
-    variables_unused_variable: true
-    variables_unused_import: true
-    variables_unused_wildcard_import: true
-    variables_unused_argument: true
-    variables_global_variable_not_assigned: true
-    typecheck_redundant_keyword_arg: true
-    imports_import_self: true
-    format_superfluous_parens: true
-    exceptions_pointless_except: true
-    design_interface_not_implemented: true
-    design_abstract_class_not_used: true
-    basic_useless_else_on_loop: true
-    basic_unreachable: true
-    basic_unnecessary_pass: true
-    basic_unnecessary_lambda: true
-    basic_pointless_string_statement: true
-    basic_pointless_statement: true
-    basic_expression_not_assigned: true
-    variables_redefined_outer_name: true
-    variables_redefined_builtin: true
-    variables_redefine_in_handler: true
-    newstyle_bad_super_call: true
-    logging_not_lazy: true
-    exceptions_broad_except: true
-    exceptions_bare_except: true
-    classes_super_init_not_called: true
-    classes_protected_access: true
-    classes_non_parent_init_called: true
-    classes_bad_mcs_classmethod_argument: true
-    classes_attribute_defined_outside_init: true
-    classes_method_hidden: true
-    basic_lost_exception: true
-    basic_function_redefined: true
-    basic_exec_used: true
-    basic_eval_used: true
-    basic_dangerous_default_value: true
-    design_abstract_class_little_used: true
-    imports_deprecated_module: true
-    format_old_ne_operator: true
-    format_backtick: true
-    basic_old_raise_syntax: true
-    variables_used_before_assignment: true
-    variables_unpacking_non_sequence: true
-    variables_undefined_variable: true
-    variables_undefined_loop_variable: true
-    variables_undefined_all_variable: true
-    variables_unbalanced_tuple_unpacking: true
-    variables_no_name_in_module: true
-    variables_invalid_all_object: true
-    variables_global_variable_undefined: true
-    typecheck_unexpected_keyword_arg: true
-    typecheck_not_callable: true
-    typecheck_no_value_for_parameter: true
-    typecheck_no_member: true
-    typecheck_too_many_function_args: true
-    typecheck_missing_kwoa: true
-    typecheck_maybe_no_member: true
-    typecheck_duplicate_keyword_arg: true
-    typecheck_assignment_from_none: true
-    typecheck_assignment_from_no_return: true
-    string_unused_format_string_key: true
-    string_truncated_format_string: true
-    string_too_many_format_args: true
-    string_too_few_format_args: true
-    string_mixed_format_string: true
-    string_missing_format_string_key: true
-    string_format_needs_mapping: true
-    string_constant_anomalous_unicode_escape_in_string: true
-    string_constant_anomalous_backslash_in_string: true
-    string_bad_str_strip_call: true
-    string_bad_format_string_key: true
-    string_bad_format_character: true
-    open_mode_bad_open_mode: true
-    logging_unsupported_format: true
-    logging_too_many_args: true
-    logging_too_few_args: true
-    logging_format_truncated: true
-    imports_reimported: true
-    imports_import_error: true
-    imports_cyclic_import: true
-    exceptions_raising_string: true
-    exceptions_raising_non_exception: true
-    exceptions_raising_bad_type: true
-    exceptions_notimplemented_raised: true
-    exceptions_catching_non_exception: true
-    exceptions_bad_except_order: true
-    classes_valid_slots: true
-    classes_signature_differs: true
-    classes_non_iterator_returned: true
-    classes_no_method_argument: true
-    classes_missing_interface_method: true
-    classes_interface_is_not_class: true
-    classes_bad_staticmethod_argument: true
-    classes_bad_context_manager: true
-    classes_arguments_differ: true
-    classes_access_member_before_definition: true
-    classes_abstract_method: true
-    basic_yield_outside_function: true
-    basic_return_outside_function: true
-    basic_return_in_init: true
-    basic_return_arg_in_generator: true
-    basic_not_in_loop: true
-    basic_nonexistent_operator: true
-    basic_missing_reversed_argument: true
-    basic_missing_module_attribute: true
-    basic_init_is_generator: true
-    basic_duplicate_key: true
-    basic_duplicate_argument_name: true
-    basic_bad_reversed_sequence: true
-    basic_assert_on_tuple: true
-    basic_abstract_class_instantiated: true
-    format_lowercase_l_suffix: true
-    classes_no_self_use: true
-    classes_no_init: true
-    exceptions_binary_op_exception: true
-    variables_global_statement: true
-
-filter:
-  excluded_paths:
-    - test/*
-
-tools:
-  external_code_coverage:
-    timeout: 1200
-    runs: 6
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index b68fb44..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,44 +0,0 @@
-sudo: false
-language: python
-env:
-  global:
-    - NOSE_NOLOGCAPTURE=true
-    - NOSE_VERBOSE=2
-    - NOSE_WITH_COVERAGE=true
-    - NOSE_COVER_PACKAGE=neovim
-  matrix:
-    - CI_TARGET=tests
-matrix:
-  include:
-    - python: 2.7
-      env: CI_TARGET=flake
-    - python: 3.4
-      env: CI_TARGET=flake
-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
-  - 3.5
-  - pypy
-before_install:
-  - if [ $CI_TARGET = tests ]; then
-      eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64";
-      pip install -q scrutinizer-ocular;
-    else
-      pip install -q flake8 flake8-import-order flake8-docstrings pep8-naming;
-    fi
-install:
-  - pip install .
-script:
-  - if [ $CI_TARGET = tests ]; then
-      NVIM_CHILD_ARGV='["nvim", "-u", "NONE", "--embed"]' nosetests;
-    else
-      flake8 neovim;
-    fi
-after_script:
-  - if [ $CI_TARGET = tests ]; then
-      ocular;
-    fi
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index 9942365..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
-Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "{}"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright 2014 Thiago Arruda
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..e8837ea
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,11 @@
+Metadata-Version: 1.1
+Name: neovim
+Version: 0.1.3
+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.3.tar.gz
+Description: UNKNOWN
+Platform: UNKNOWN
diff --git a/README.md b/README.md
deleted file mode 100644
index fcfa566..0000000
--- a/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-### Python client to [Neovim](https://github.com/neovim/neovim)
-
-[![Build Status](https://travis-ci.org/neovim/python-client.svg?branch=master)](https://travis-ci.org/neovim/python-client)
-[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/neovim/python-client/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/neovim/python-client/?branch=master)
-[![Code Coverage](https://scrutinizer-ci.com/g/neovim/python-client/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/neovim/python-client/?branch=master)
-
-Library for scripting Nvim processes through its msgpack-rpc API.
-
-#### Installation
-
-```sh
-pip install neovim
-```
-
-#### Usage through the python REPL
-
-A number of different transports are supported, but the simplest way to get
-started is with the python REPL. First, start Nvim with a known address (or
-use the `$NVIM_LISTEN_ADDRESS` of a running instance): 
-
-```sh
-$ NVIM_LISTEN_ADDRESS=/tmp/nvim nvim
-```
-
-In another terminal, connect a python REPL to Nvim (note that the API is
-similar to the one exposed by the [python-vim
-bridge](http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python-vim)):
-
-```python
->>> from neovim import attach
-# Create a python API session attached to unix domain socket created above:
->>> nvim = attach('socket', path='/tmp/nvim')
-# Now do some work. 
->>> buffer = nvim.buffers[0] # Get the first buffer
->>> buffer[0] = 'replace first line'
->>> buffer[:] = ['replace whole buffer']
->>> nvim.command('vsplit')
->>> nvim.windows[1].width = 10
->>> nvim.vars['global_var'] = [1, 2, 3]
->>> nvim.eval('g:global_var')
-[1, 2, 3]
-```
-
-You can embed neovim into your python application instead of binding to a running neovim instance.
-
-```python
->>> from neovim import attach
->>> nvim = attach('child', argv=["/bin/env", "nvim", "--embed"])
-```
-
-The tests can be consulted for more examples.
diff --git a/neovim.egg-info/PKG-INFO b/neovim.egg-info/PKG-INFO
new file mode 100644
index 0000000..e8837ea
--- /dev/null
+++ b/neovim.egg-info/PKG-INFO
@@ -0,0 +1,11 @@
+Metadata-Version: 1.1
+Name: neovim
+Version: 0.1.3
+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.3.tar.gz
+Description: UNKNOWN
+Platform: UNKNOWN
diff --git a/neovim.egg-info/SOURCES.txt b/neovim.egg-info/SOURCES.txt
new file mode 100644
index 0000000..8616aa4
--- /dev/null
+++ b/neovim.egg-info/SOURCES.txt
@@ -0,0 +1,35 @@
+setup.cfg
+setup.py
+neovim/__init__.py
+neovim/compat.py
+neovim.egg-info/PKG-INFO
+neovim.egg-info/SOURCES.txt
+neovim.egg-info/dependency_links.txt
+neovim.egg-info/not-zip-safe
+neovim.egg-info/requires.txt
+neovim.egg-info/top_level.txt
+neovim/api/__init__.py
+neovim/api/buffer.py
+neovim/api/common.py
+neovim/api/nvim.py
+neovim/api/tabpage.py
+neovim/api/window.py
+neovim/msgpack_rpc/__init__.py
+neovim/msgpack_rpc/async_session.py
+neovim/msgpack_rpc/msgpack_stream.py
+neovim/msgpack_rpc/session.py
+neovim/msgpack_rpc/event_loop/__init__.py
+neovim/msgpack_rpc/event_loop/asyncio.py
+neovim/msgpack_rpc/event_loop/base.py
+neovim/msgpack_rpc/event_loop/uv.py
+neovim/plugin/__init__.py
+neovim/plugin/decorators.py
+neovim/plugin/host.py
+test/test_buffer.py
+test/test_client_rpc.py
+test/test_common.py
+test/test_concurrency.py
+test/test_events.py
+test/test_tabpage.py
+test/test_vim.py
+test/test_window.py
\ No newline at end of file
diff --git a/neovim.egg-info/dependency_links.txt b/neovim.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/neovim.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/neovim.egg-info/not-zip-safe b/neovim.egg-info/not-zip-safe
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/neovim.egg-info/not-zip-safe
@@ -0,0 +1 @@
+
diff --git a/neovim.egg-info/requires.txt b/neovim.egg-info/requires.txt
new file mode 100644
index 0000000..ade24eb
--- /dev/null
+++ b/neovim.egg-info/requires.txt
@@ -0,0 +1,3 @@
+msgpack-python>=0.4.0
+trollius
+greenlet
diff --git a/neovim.egg-info/top_level.txt b/neovim.egg-info/top_level.txt
new file mode 100644
index 0000000..d8ef3de
--- /dev/null
+++ b/neovim.egg-info/top_level.txt
@@ -0,0 +1 @@
+neovim
diff --git a/neovim/__init__.py b/neovim/__init__.py
index b2a0768..b350fdf 100644
--- a/neovim/__init__.py
+++ b/neovim/__init__.py
@@ -16,7 +16,7 @@ from .plugin import (Host, autocmd, command, encoding, function, plugin,
 __all__ = ('tcp_session', 'socket_session', 'stdio_session', 'child_session',
            'start_host', 'autocmd', 'command', 'encoding', 'function',
            'plugin', 'rpc_export', 'Host', 'DecodeHook', 'Nvim',
-           'SessionHook', 'shutdown_hook', 'attach')
+           'SessionHook', 'shutdown_hook', 'attach', 'setup_logging')
 
 
 def start_host(session=None):
@@ -43,23 +43,8 @@ def start_host(session=None):
     if not plugins:
         sys.exit('must specify at least one plugin as argument')
 
-    logger = logging.getLogger(__name__)
-    if 'NVIM_PYTHON_LOG_FILE' in os.environ:
-        logfile = (os.environ['NVIM_PYTHON_LOG_FILE'].strip() +
-                   '_' + str(os.getpid()))
-        handler = logging.FileHandler(logfile, 'w')
-        handler.formatter = logging.Formatter(
-            '%(asctime)s [%(levelname)s @ '
-            '%(filename)s:%(funcName)s:%(lineno)s] %(process)s - %(message)s')
-        logging.root.addHandler(handler)
-        level = logging.INFO
-        if 'NVIM_PYTHON_LOG_LEVEL' in os.environ:
-            l = getattr(logging,
-                        os.environ['NVIM_PYTHON_LOG_LEVEL'].strip(),
-                        level)
-            if isinstance(l, int):
-                level = l
-        logger.setLevel(level)
+    setup_logging()
+
     if not session:
         session = stdio_session()
     host = Host(Nvim.from_session(session))
@@ -95,6 +80,27 @@ def attach(session_type, address=None, port=None, path=None, argv=None):
     return Nvim.from_session(session)
 
 
+def setup_logging():
+    """Setup logging according to environment variables."""
+    logger = logging.getLogger(__name__)
+    if 'NVIM_PYTHON_LOG_FILE' in os.environ:
+        logfile = (os.environ['NVIM_PYTHON_LOG_FILE'].strip() +
+                   '_' + str(os.getpid()))
+        handler = logging.FileHandler(logfile, 'w')
+        handler.formatter = logging.Formatter(
+            '%(asctime)s [%(levelname)s @ '
+            '%(filename)s:%(funcName)s:%(lineno)s] %(process)s - %(message)s')
+        logging.root.addHandler(handler)
+        level = logging.INFO
+        if 'NVIM_PYTHON_LOG_LEVEL' in os.environ:
+            l = getattr(logging,
+                        os.environ['NVIM_PYTHON_LOG_LEVEL'].strip(),
+                        level)
+            if isinstance(l, int):
+                level = l
+        logger.setLevel(level)
+
+
 # Required for python 2.6
 class NullHandler(logging.Handler):
     def emit(self, record):
diff --git a/neovim/api/nvim.py b/neovim/api/nvim.py
index 7d7ce49..9650f31 100644
--- a/neovim/api/nvim.py
+++ b/neovim/api/nvim.py
@@ -2,6 +2,8 @@
 import functools
 import os
 
+from traceback import format_exc, format_stack
+
 from msgpack import ExtType
 
 from .buffer import Buffer
@@ -204,9 +206,9 @@ class Nvim(object):
         """Print `msg` as a normal message."""
         return self._session.request('vim_out_write', msg)
 
-    def err_write(self, msg):
+    def err_write(self, msg, async=False):
         """Print `msg` as an error message."""
-        return self._session.request('vim_err_write', msg)
+        return self._session.request('vim_err_write', msg, async=async)
 
     def quit(self, quit_command='qa!'):
         """Send a quit command to Nvim.
@@ -226,6 +228,29 @@ class Nvim(object):
         """Return new src_id for use with Buffer.add_highlight."""
         return self.current.buffer.add_highlight("", 0, src_id=0)
 
+    def async_call(self, fn, *args, **kwargs):
+        """Schedule `fn` to be called by the event loop soon.
+
+        This function is thread-safe, and is the only way code not
+        on the main thread could interact with nvim api objects.
+
+        This function can also be called in a synchronous
+        event handler, just before it returns, to defer execution
+        that shouldn't block neovim.
+        """
+        call_point = ''.join(format_stack(None, 5)[:-1])
+
+        def handler():
+            try:
+                fn(*args, **kwargs)
+            except Exception as err:
+                msg = ("error caught while executing async callback:\n"
+                       "{!r}\n{}\n \nthe call was requested at\n{}"
+                       .format(err, format_exc(5), call_point))
+                self.err_write(msg, async=True)
+                raise
+        self._session.threadsafe_call(handler)
+
 
 class Current(object):
 
diff --git a/neovim/msgpack_rpc/session.py b/neovim/msgpack_rpc/session.py
index 9a74be7..c2bfbc6 100644
--- a/neovim/msgpack_rpc/session.py
+++ b/neovim/msgpack_rpc/session.py
@@ -31,7 +31,11 @@ class Session(object):
     def threadsafe_call(self, fn, *args, **kwargs):
         """Wrapper around `AsyncSession.threadsafe_call`."""
         def handler():
-            fn(*args, **kwargs)
+            try:
+                fn(*args, **kwargs)
+            except Exception:
+                warn("error caught while excecuting async callback\n%s\n",
+                     format_exc())
 
         def greenlet_wrapper():
             gr = greenlet.greenlet(handler)
@@ -197,6 +201,7 @@ class Session(object):
             except Exception:
                 warn("error caught while processing notification '%s %s': %s",
                      name, args, format_exc())
+
             debug('greenlet %s is now dying...', gr)
 
         gr = greenlet.greenlet(handler)
diff --git a/neovim/plugin/host.py b/neovim/plugin/host.py
index b5f6110..9088163 100644
--- a/neovim/plugin/host.py
+++ b/neovim/plugin/host.py
@@ -6,10 +6,11 @@ import logging
 import os
 import os.path
 
+from traceback import format_exc
+
 from ..api import DecodeHook
 from ..compat import IS_PYTHON3, find_module
 
-
 __all__ = ('Host')
 
 logger = logging.getLogger(__name__)
@@ -76,7 +77,13 @@ class Host(object):
             return
 
         debug('calling notification handler for "%s", args: "%s"', name, args)
-        handler(*args)
+        try:
+            handler(*args)
+        except Exception as err:
+            msg = ("error caught in async handler '{} {}':\n{!r}\n{}"
+                   .format(name, args, err, format_exc(5)))
+            self.nvim.err_write(msg, async=True)
+            raise
 
     def _load(self, plugins):
         for path in plugins:
diff --git a/neovim/ui/__init__.py b/neovim/ui/__init__.py
deleted file mode 100644
index 74c52e0..0000000
--- a/neovim/ui/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-"""Neovim remote UI prototypes."""
diff --git a/neovim/ui/cli.py b/neovim/ui/cli.py
deleted file mode 100644
index b6c58cc..0000000
--- a/neovim/ui/cli.py
+++ /dev/null
@@ -1,73 +0,0 @@
-"""CLI for accessing the gtk/tickit UIs implemented by this package."""
-import shlex
-
-import click
-
-from .ui_bridge import UIBridge
-from .. import attach
-from ..api import DecodeHook
-from ..compat import IS_PYTHON3
-
-
- at click.command(context_settings=dict(allow_extra_args=True))
- at click.option('--prog')
- at click.option('--notify', '-n', default=False, is_flag=True)
- at click.option('--listen', '-l')
- at click.option('--connect', '-c')
- at click.option('--profile',
-              default='disable',
-              type=click.Choice(['ncalls', 'tottime', 'percall', 'cumtime',
-                                 'name', 'disable']))
- at click.pass_context
-def main(ctx, prog, notify, listen, connect, profile):
-    """Entry point."""
-    address = connect or listen
-
-    if address:
-        import re
-        p = re.compile(r'^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?:\:\d{1,5})?$')
-
-        if p.match(address):
-            args = ('tcp',)
-            kwargs = {'address': address}
-        else:
-            args = ('socket',)
-            kwargs = {'path': address}
-
-    if connect:
-        # connect to existing instance listening on address
-        nvim = attach(*args, **kwargs)
-    elif listen:
-        # spawn detached instance listening on address and connect to it
-        import os
-        import time
-        from subprocess import Popen
-        os.environ['NVIM_LISTEN_ADDRESS'] = address
-        nvim_argv = shlex.split(prog or 'nvim --headless') + ctx.args
-        # spawn the nvim with stdio redirected to /dev/null.
-        dnull = open(os.devnull)
-        p = Popen(nvim_argv, stdin=dnull, stdout=dnull, stderr=dnull)
-        dnull.close()
-        while p.poll() or p.returncode is None:
-            try:
-                nvim = attach(*args, **kwargs)
-                break
-            except IOError:
-                # socket not ready yet
-                time.sleep(0.050)
-    else:
-        # spawn embedded instance
-        nvim_argv = shlex.split(prog or 'nvim --embed') + ctx.args
-        nvim = attach('child', argv=nvim_argv)
-
-    if IS_PYTHON3:
-        nvim = nvim.with_hook(DecodeHook())
-
-    from .gtk_ui import GtkUI
-    ui = GtkUI()
-    bridge = UIBridge()
-    bridge.connect(nvim, ui, profile if profile != 'disable' else None, notify)
-
-
-if __name__ == '__main__':
-    main()
diff --git a/neovim/ui/gtk_ui.py b/neovim/ui/gtk_ui.py
deleted file mode 100644
index 0ac6696..0000000
--- a/neovim/ui/gtk_ui.py
+++ /dev/null
@@ -1,587 +0,0 @@
-"""Neovim Gtk+ UI."""
-import math
-
-import cairo
-
-from gi.repository import GLib, GObject, Gdk, Gtk, Pango, PangoCairo
-
-from .screen import Screen
-
-
-__all__ = ('GtkUI',)
-
-
-SHIFT = Gdk.ModifierType.SHIFT_MASK
-CTRL = Gdk.ModifierType.CONTROL_MASK
-ALT = Gdk.ModifierType.MOD1_MASK
-
-
-# Translation table for the names returned by Gdk.keyval_name that don't match
-# the corresponding nvim key names.
-KEY_TABLE = {
-    'slash': '/',
-    'backslash': '\\',
-    'dead_circumflex': '^',
-    'at': '@',
-    'numbersign': '#',
-    'dollar': '$',
-    'percent': '%',
-    'ampersand': '&',
-    'asterisk': '*',
-    'parenleft': '(',
-    'parenright': ')',
-    'underscore': '_',
-    'plus': '+',
-    'minus': '-',
-    'bracketleft': '[',
-    'bracketright': ']',
-    'braceleft': '{',
-    'braceright': '}',
-    'dead_diaeresis': '"',
-    'dead_acute': "'",
-    'less': "<",
-    'greater': ">",
-    'comma': ",",
-    'period': ".",
-    'BackSpace': 'BS',
-    'Return': 'CR',
-    'Escape': 'Esc',
-    'Delete': 'Del',
-    'Page_Up': 'PageUp',
-    'Page_Down': 'PageDown',
-    'Enter': 'CR',
-    'ISO_Left_Tab': 'Tab'
-}
-
-
-if (GLib.MAJOR_VERSION, GLib.MINOR_VERSION,) <= (2, 32,):
-    GLib.threads_init()
-
-
-class GtkUI(object):
-
-    """Gtk+ UI class."""
-
-    def __init__(self):
-        """Initialize the UI instance."""
-        self._redraw_arg = None
-        self._foreground = -1
-        self._background = -1
-        self._font_size = 13
-        self._font_name = 'Monospace'
-        self._screen = None
-        self._attrs = None
-        self._busy = False
-        self._mouse_enabled = False
-        self._insert_cursor = False
-        self._blink = False
-        self._blink_timer_id = None
-        self._resize_timer_id = None
-        self._pressed = None
-        self._invalid = None
-        self._pending = [0, 0, 0]
-        self._reset_cache()
-
-    def start(self, bridge):
-        """Start the UI event loop."""
-        bridge.attach(80, 24, True)
-        drawing_area = Gtk.DrawingArea()
-        drawing_area.connect('draw', self._gtk_draw)
-        window = Gtk.Window()
-        window.add(drawing_area)
-        window.set_events(window.get_events() |
-                          Gdk.EventMask.BUTTON_PRESS_MASK |
-                          Gdk.EventMask.BUTTON_RELEASE_MASK |
-                          Gdk.EventMask.POINTER_MOTION_MASK |
-                          Gdk.EventMask.SCROLL_MASK)
-        window.connect('configure-event', self._gtk_configure)
-        window.connect('delete-event', self._gtk_quit)
-        window.connect('key-press-event', self._gtk_key)
-        window.connect('button-press-event', self._gtk_button_press)
-        window.connect('button-release-event', self._gtk_button_release)
-        window.connect('motion-notify-event', self._gtk_motion_notify)
-        window.connect('scroll-event', self._gtk_scroll)
-        window.show_all()
-        im_context = Gtk.IMContextSimple()
-        im_context.connect('commit', self._gtk_input)
-        self._pango_context = drawing_area.create_pango_context()
-        self._drawing_area = drawing_area
-        self._window = window
-        self._im_context = im_context
-        self._bridge = bridge
-        Gtk.main()
-
... 1283 lines suppressed ...

-- 
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