forked from VimPlug/jedi
Merge master into the away branch. The merge conflict that was resolved was to get 'debug.py' working again.
This commit is contained in:
@@ -41,6 +41,9 @@ Jedi can currently be used with the following editors:
|
|||||||
<https://projects.kde.org/projects/kde/applications/kate/repository/show?rev=KDE%2F4.13>`_]
|
<https://projects.kde.org/projects/kde/applications/kate/repository/show?rev=KDE%2F4.13>`_]
|
||||||
- Atom_ (autocomplete-python_)
|
- Atom_ (autocomplete-python_)
|
||||||
- SourceLair_
|
- SourceLair_
|
||||||
|
- `GNOME Builder`_ (with support for GObject Introspection)
|
||||||
|
- `Visual Studio Code`_ (via `Python Extension <https://marketplace.visualstudio.com/items?itemName=donjayamanne.python>`_)
|
||||||
|
- Gedit (gedi_)
|
||||||
|
|
||||||
And it powers the following projects:
|
And it powers the following projects:
|
||||||
|
|
||||||
@@ -202,3 +205,6 @@ Acknowledgements
|
|||||||
.. _Atom: https://atom.io/
|
.. _Atom: https://atom.io/
|
||||||
.. _autocomplete-python: https://atom.io/packages/autocomplete-python
|
.. _autocomplete-python: https://atom.io/packages/autocomplete-python
|
||||||
.. _SourceLair: https://www.sourcelair.com
|
.. _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
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ Not yet implemented:
|
|||||||
|
|
||||||
- manipulations of instances outside the instance variables without using
|
- manipulations of instances outside the instance variables without using
|
||||||
methods
|
methods
|
||||||
|
- implicit namespace packages (Python 3.3+, `PEP 420 <https://www.python.org/dev/peps/pep-0420/>`_)
|
||||||
|
|
||||||
Will probably never be implemented:
|
Will probably never be implemented:
|
||||||
|
|
||||||
|
|||||||
@@ -47,14 +47,14 @@ Completions:
|
|||||||
>>> script = jedi.Script(source, 1, 19, '')
|
>>> script = jedi.Script(source, 1, 19, '')
|
||||||
>>> script
|
>>> script
|
||||||
<jedi.api.Script object at 0x2121b10>
|
<jedi.api.Script object at 0x2121b10>
|
||||||
>>> completions = script.complete()
|
>>> completions = script.completions()
|
||||||
>>> completions
|
>>> completions
|
||||||
[<Completion: load>, <Completion: loads>]
|
[<Completion: load>, <Completion: loads>]
|
||||||
>>> completions[1]
|
>>> completions[1]
|
||||||
<Completion: loads>
|
<Completion: loads>
|
||||||
>>> completions[1].complete
|
>>> completions[1].complete
|
||||||
'oads'
|
'oads'
|
||||||
>>> completions[1].word
|
>>> completions[1].name
|
||||||
'loads'
|
'loads'
|
||||||
|
|
||||||
Definitions / Goto:
|
Definitions / Goto:
|
||||||
|
|||||||
@@ -55,6 +55,15 @@ SourceLair:
|
|||||||
|
|
||||||
- SourceLair_
|
- SourceLair_
|
||||||
|
|
||||||
|
GNOME Builder:
|
||||||
|
|
||||||
|
- `GNOME Builder`_ `supports it natively
|
||||||
|
<https://git.gnome.org/browse/gnome-builder/tree/plugins/jedi>`__,
|
||||||
|
and is enabled by default.
|
||||||
|
|
||||||
|
Gedit:
|
||||||
|
|
||||||
|
- gedi_
|
||||||
|
|
||||||
.. _other-software:
|
.. _other-software:
|
||||||
|
|
||||||
@@ -96,3 +105,5 @@ Using a custom ``$HOME/.pythonrc.py``
|
|||||||
.. _kate: http://kate-editor.org/
|
.. _kate: http://kate-editor.org/
|
||||||
.. _autocomplete-python: https://atom.io/packages/autocomplete-python
|
.. _autocomplete-python: https://atom.io/packages/autocomplete-python
|
||||||
.. _SourceLair: https://www.sourcelair.com
|
.. _SourceLair: https://www.sourcelair.com
|
||||||
|
.. _GNOME Builder: https://wiki.gnome.org/Apps/Builder/
|
||||||
|
.. _gedi: https://github.com/isamert/gedi
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ def find_module_py33(string, path=None):
|
|||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
# See #491. Importlib might raise a ValueError, to avoid this, we
|
# See #491. Importlib might raise a ValueError, to avoid this, we
|
||||||
# just raise an ImportError to fix the issue.
|
# just raise an ImportError to fix the issue.
|
||||||
raise ImportError("Originally ValueError: " + str(e))
|
raise ImportError("Originally " + repr(e))
|
||||||
|
|
||||||
if loader is None:
|
if loader is None:
|
||||||
raise ImportError("Couldn't find a loader for {0}".format(string))
|
raise ImportError("Couldn't find a loader for {0}".format(string))
|
||||||
|
|||||||
@@ -3,18 +3,41 @@ import inspect
|
|||||||
import os
|
import os
|
||||||
import time
|
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:
|
try:
|
||||||
if os.name == 'nt':
|
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
|
raise ImportError
|
||||||
else:
|
else:
|
||||||
# Use colorama for nicer console output.
|
# Use colorama for nicer console output.
|
||||||
from colorama import Fore, init
|
from colorama import Fore, init
|
||||||
from colorama import initialise
|
from colorama import initialise
|
||||||
# pytest resets the stream at the end - causes troubles. Since after
|
def _lazy_colorama_init():
|
||||||
# every output the stream is reset automatically we don't need this.
|
"""
|
||||||
|
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
|
initialise.atexit_done = True
|
||||||
init()
|
init()
|
||||||
|
_inited = True
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
class Fore(object):
|
class Fore(object):
|
||||||
RED = ''
|
RED = ''
|
||||||
@@ -72,6 +95,7 @@ def dbg(message, *args, **kwargs):
|
|||||||
mod = inspect.getmodule(frm[0])
|
mod = inspect.getmodule(frm[0])
|
||||||
if not (mod.__name__ in ignored_modules):
|
if not (mod.__name__ in ignored_modules):
|
||||||
i = ' ' * _debug_indent
|
i = ' ' * _debug_indent
|
||||||
|
_lazy_colorama_init()
|
||||||
debug_function(color, i + 'dbg: ' + message % tuple(u(repr(a)) for a in args))
|
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``.
|
:param str color: A string that is an attribute of ``colorama.Fore``.
|
||||||
"""
|
"""
|
||||||
col = getattr(Fore, color)
|
col = getattr(Fore, color)
|
||||||
|
_lazy_colorama_init()
|
||||||
if not is_py3:
|
if not is_py3:
|
||||||
str_out = str_out.encode(encoding, 'replace')
|
str_out = str_out.encode(encoding, 'replace')
|
||||||
print(col + str_out + Fore.RESET)
|
print(col + str_out + Fore.RESET)
|
||||||
|
|||||||
Reference in New Issue
Block a user