diff --git a/README.rst b/README.rst index de2b4864..29edb55d 100644 --- a/README.rst +++ b/README.rst @@ -41,6 +41,9 @@ 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 `_) +- Gedit (gedi_) And it powers the following projects: @@ -202,3 +205,6 @@ Acknowledgements .. _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 +.. _Visual Studio Code: https://code.visualstudio.com/ +.. _gedi: https://github.com/isamert/gedi 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: 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: diff --git a/docs/docs/usage.rst b/docs/docs/usage.rst index 55d9aca6..48a692c7 100644 --- a/docs/docs/usage.rst +++ b/docs/docs/usage.rst @@ -55,6 +55,15 @@ SourceLair: - SourceLair_ +GNOME Builder: + +- `GNOME Builder`_ `supports it natively + `__, + and is enabled by default. + +Gedit: + +- gedi_ .. _other-software: @@ -96,3 +105,5 @@ 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/ +.. _gedi: https://github.com/isamert/gedi diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 60c9dcb5..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: " + str(e)) + raise ImportError("Originally " + repr(e)) if loader is None: raise ImportError("Couldn't find a loader for {0}".format(string)) diff --git a/jedi/debug.py b/jedi/debug.py index 430a0329..03a02596 100644 --- a/jedi/debug.py +++ b/jedi/debug.py @@ -3,18 +3,41 @@ import inspect 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 + try: if os.name == 'nt': - # does not work on Windows, as pyreadline and colorama interfere + # Does not work on Windows, as pyreadline and colorama interfere raise ImportError else: # 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. - initialise.atexit_done = True - init() + 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 + except ImportError: class Fore(object): RED = '' @@ -72,6 +95,7 @@ def dbg(message, *args, **kwargs): mod = inspect.getmodule(frm[0]) if not (mod.__name__ in ignored_modules): i = ' ' * _debug_indent + _lazy_colorama_init() debug_function(color, i + 'dbg: ' + message % tuple(u(repr(a)) for a in args)) @@ -95,6 +119,7 @@ def print_to_stdout(color, str_out): :param str color: A string that is an attribute of ``colorama.Fore``. """ col = getattr(Fore, color) + _lazy_colorama_init() if not is_py3: str_out = str_out.encode(encoding, 'replace') print(col + str_out + Fore.RESET)