From 2ec196fa2e7abfabe00641fdb8e4439be2e96e82 Mon Sep 17 00:00:00 2001 From: Mariano Reingart Date: Wed, 30 Dec 2015 06:03:51 -0300 Subject: [PATCH 1/9] Update API doc for completions At least in jedi version 0.9.0 the API seems to change to: * complete method is now completions * words attribute is now name Example: ``` (venv)reingart@S55t-B:~$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import jedi >>> jedi.__version__ '0.9.0' >>> source = '''import json; json.l''' >>> script = jedi.Script(source, 1, 19, '') >>> script >>> completions = script.completions() >>> completions [, ] >>> completions[1].complete 'oads' >>> completions[1].name u'loads' >>> ``` --- docs/docs/plugin-api.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/plugin-api.rst b/docs/docs/plugin-api.rst index ce2c802d..93b081ef 100644 --- a/docs/docs/plugin-api.rst +++ b/docs/docs/plugin-api.rst @@ -47,14 +47,14 @@ Completions: >>> script = jedi.Script(source, 1, 19, '') >>> script - >>> completions = script.complete() + >>> completions = script.completions() >>> completions [, ] >>> completions[1] >>> completions[1].complete 'oads' - >>> completions[1].word + >>> completions[1].name 'loads' Definitions / Goto: From c2874ff84a528a242ac0c71ffb8e9b69285197c7 Mon Sep 17 00:00:00 2001 From: Sergey Glazyrin Date: Tue, 26 Jan 2016 22:54:15 +0100 Subject: [PATCH 2/9] fix for #122 --- jedi/_compatibility.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 1a1e943f..63c76b9a 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -25,7 +25,7 @@ def find_module_py33(string, path=None): except ValueError as e: # See #491. Importlib might raise a ValueError, to avoid this, we # just raise an ImportError to fix the issue. - raise ImportError("Originally ValueError: " + e.message) + raise ImportError("Originally " + repr(e)) if loader is None: raise ImportError("Couldn't find a loader for {0}".format(string)) From 81e07b866fd00cbb935267b339f79d53ddc39d17 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 11 Feb 2016 13:02:27 -0800 Subject: [PATCH 3/9] Add GNOME Builder to list of supported editors Support is provided out of the box as long as python3-jedi is installed. Additionally, Builder's implementation includes support for GObject Introspection (and therefore Gtk). --- README.rst | 2 ++ docs/docs/usage.rst | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/README.rst b/README.rst index 7bab1904..389dee84 100644 --- a/README.rst +++ b/README.rst @@ -41,6 +41,7 @@ Jedi can currently be used with the following editors: `_] - Atom_ (autocomplete-python_) - SourceLair_ +- `GNOME Builder`_ (with support for GObject Introspection) And it powers the following projects: @@ -191,3 +192,4 @@ For more detailed information visit the `testing documentation .. _Atom: https://atom.io/ .. _autocomplete-python: https://atom.io/packages/autocomplete-python .. _SourceLair: https://www.sourcelair.com +.. _GNOME Builder: https://wiki.gnome.org/Apps/Builder diff --git a/docs/docs/usage.rst b/docs/docs/usage.rst index 55d9aca6..0bc0a97a 100644 --- a/docs/docs/usage.rst +++ b/docs/docs/usage.rst @@ -55,6 +55,12 @@ SourceLair: - SourceLair_ +GNOME Builder: + +- `GNOME Builder`_ `supports it natively + `__, + and is enabled by default. + .. _other-software: @@ -96,3 +102,4 @@ Using a custom ``$HOME/.pythonrc.py`` .. _kate: http://kate-editor.org/ .. _autocomplete-python: https://atom.io/packages/autocomplete-python .. _SourceLair: https://www.sourcelair.com +.. _GNOME Builder: https://wiki.gnome.org/Apps/Builder/ From a18574246e8dbd55a73d370720f4542d10be6091 Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Thu, 3 Mar 2016 23:02:54 +0100 Subject: [PATCH 4/9] Add vscode to editors using jedi The python extension for Visual Studio Code uses Jedi. As seen here: https://github.com/DonJayamanne/pythonVSCode/tree/master/pythonFiles/jedi --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index 389dee84..ec6d75a4 100644 --- a/README.rst +++ b/README.rst @@ -42,6 +42,7 @@ Jedi can currently be used with the following editors: - Atom_ (autocomplete-python_) - SourceLair_ - `GNOME Builder`_ (with support for GObject Introspection) +- `Visual Studio Code`_ (via `Python Extension `_) And it powers the following projects: @@ -193,3 +194,4 @@ For more detailed information visit the `testing documentation .. _autocomplete-python: https://atom.io/packages/autocomplete-python .. _SourceLair: https://www.sourcelair.com .. _GNOME Builder: https://wiki.gnome.org/Apps/Builder +.. _Visual Studio Code: https://code.visualstudio.com/ From ac9133aafc9718e557b0f04b8d3d220267172b85 Mon Sep 17 00:00:00 2001 From: Travis Bradshaw Date: Wed, 9 Mar 2016 22:37:21 -0600 Subject: [PATCH 5/9] Update unsupported features list with "implicit namespace packages" --- docs/docs/features.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs/features.rst b/docs/docs/features.rst index 48c41ead..cbddae69 100644 --- a/docs/docs/features.rst +++ b/docs/docs/features.rst @@ -64,6 +64,7 @@ Not yet implemented: - manipulations of instances outside the instance variables without using methods +- implicit namespace packages (Python 3.3+, `PEP 420 `_) Will probably never be implemented: From 07c7a69306a4b1d005b9b73974d633abe111ea1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0sa=20Mert=20G=C3=BCrb=C3=BCz?= Date: Fri, 15 Apr 2016 14:32:13 +0300 Subject: [PATCH 6/9] Add gedit to editors that uses jedi --- README.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.rst b/README.rst index ec6d75a4..af967db0 100644 --- a/README.rst +++ b/README.rst @@ -43,6 +43,7 @@ Jedi can currently be used with the following editors: - SourceLair_ - `GNOME Builder`_ (with support for GObject Introspection) - `Visual Studio Code`_ (via `Python Extension `_) +- Gedit (gedi_) And it powers the following projects: @@ -195,3 +196,4 @@ For more detailed information visit the `testing documentation .. _SourceLair: https://www.sourcelair.com .. _GNOME Builder: https://wiki.gnome.org/Apps/Builder .. _Visual Studio Code: https://code.visualstudio.com/ +.. _gedi: https://github.com/isamert/gedi From 53ca0217dd81862675e6cde526acf6fe7e94c424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0sa=20Mert=20G=C3=BCrb=C3=BCz?= Date: Fri, 15 Apr 2016 14:34:24 +0300 Subject: [PATCH 7/9] Add gedit to supported editors list --- docs/docs/usage.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/docs/usage.rst b/docs/docs/usage.rst index 0bc0a97a..48a692c7 100644 --- a/docs/docs/usage.rst +++ b/docs/docs/usage.rst @@ -61,6 +61,9 @@ GNOME Builder: `__, and is enabled by default. +Gedit: + +- gedi_ .. _other-software: @@ -103,3 +106,4 @@ Using a custom ``$HOME/.pythonrc.py`` .. _autocomplete-python: https://atom.io/packages/autocomplete-python .. _SourceLair: https://www.sourcelair.com .. _GNOME Builder: https://wiki.gnome.org/Apps/Builder/ +.. _gedi: https://github.com/isamert/gedi From 4ba6000f9204f9d2039fbb9e42289cd7333b5882 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Tue, 17 May 2016 16:46:45 -0700 Subject: [PATCH 8/9] Initialize colorama lazily Will prevent colorama from wrapping stderr/out if not in debug mode, which leads to some errors. --- jedi/debug.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/jedi/debug.py b/jedi/debug.py index 5c59a7b6..331c3744 100644 --- a/jedi/debug.py +++ b/jedi/debug.py @@ -3,6 +3,11 @@ import inspect import os import time +def _lazy_colorama_init(): + pass + +_inited=False + try: if os.name == 'nt': # does not work on Windows, as pyreadline and colorama interfere @@ -13,8 +18,13 @@ try: from colorama import initialise # pytest resets the stream at the end - causes troubles. Since after # every output the stream is reset automatically we don't need this. - initialise.atexit_done = True - init() + def _lazy_colorama_init(): + global _inited + if not _inited: + initialise.atexit_done = True + init() + _inited = True + except ImportError: class Fore(object): RED = '' @@ -63,6 +73,7 @@ def dbg(message, *args): mod = inspect.getmodule(frm[0]) if not (mod.__name__ in ignored_modules): i = ' ' * _debug_indent + _lazy_colorama_init() debug_function(NOTICE, i + 'dbg: ' + message % tuple(u(repr(a)) for a in args)) @@ -81,6 +92,7 @@ def speed(name): def print_to_stdout(level, str_out): """ The default debug function """ + _lazy_colorama_init() if level == NOTICE: col = Fore.GREEN elif level == WARNING: From e96cccb81c5085c23f7293498aca049be8f22b87 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Wed, 18 May 2016 16:48:01 -0700 Subject: [PATCH 9/9] Document a bit more --- jedi/debug.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/jedi/debug.py b/jedi/debug.py index 331c3744..d73a72ae 100644 --- a/jedi/debug.py +++ b/jedi/debug.py @@ -4,6 +4,10 @@ import os import time def _lazy_colorama_init(): + """lazily init colorama if necessary, not to screw up stdout is debug not enabled. + + This version of the function does nothing. + """ pass _inited=False @@ -16,11 +20,15 @@ try: # Use colorama for nicer console output. from colorama import Fore, init from colorama import initialise - # pytest resets the stream at the end - causes troubles. Since after - # every output the stream is reset automatically we don't need this. def _lazy_colorama_init(): + """lazily init colorama if necessary, not to screw up stdout is debug not enabled. + + This version of the function does init colorama. + """ global _inited if not _inited: + # pytest resets the stream at the end - causes troubles. Since after + # every output the stream is reset automatically we don't need this. initialise.atexit_done = True init() _inited = True