1
0
forked from VimPlug/jedi

Merge branch 'dev' of github.com:davidhalter/jedi into dev

This commit is contained in:
David Halter
2013-06-20 11:27:08 +02:00
8 changed files with 81 additions and 10 deletions

View File

@@ -5,9 +5,11 @@ env:
- TOXENV=py32 - TOXENV=py32
- TOXENV=py33 - TOXENV=py33
- TOXENV=cov - TOXENV=cov
- TOXENV=sith
matrix: matrix:
allow_failures: allow_failures:
- env: TOXENV=cov - env: TOXENV=cov
- env: TOXENV=sith
install: install:
- pip install --quiet --use-mirrors tox - pip install --quiet --use-mirrors tox
script: script:

View File

@@ -26,12 +26,15 @@ which uses Jedi's autocompletion. I encourage you to use Jedi in your IDEs.
It's really easy. If there are any problems (also with licensing), just contact It's really easy. If there are any problems (also with licensing), just contact
me. me.
Jedi can be used with the following plugins/software: Jedi can be used with the following editors:
- `VIM-Plugin <https://github.com/davidhalter/jedi-vim>`_ - Vim (jedi-vim_, YouCompleteMe_)
- `Emacs-Plugin <https://github.com/tkf/emacs-jedi>`_ - Emacs (Jedi.el_)
- `Sublime-Plugin <https://github.com/svaiter/SublimeJEDI>`_ - Sublime Text (SublimeJEDI_)
- `wdb (web debugger) <https://github.com/Kozea/wdb>`_
And it powers the following projects:
- wdb_
Here are some pictures: Here are some pictures:
@@ -123,3 +126,10 @@ Tests are also run automatically on `Travis CI
For more detailed information visit the `testing documentation For more detailed information visit the `testing documentation
<https://jedi.readthedocs.org/en/latest/docs/testing.html>`_ <https://jedi.readthedocs.org/en/latest/docs/testing.html>`_
.. _jedi-vim: https://github.com/davidhalter/jedi-vim
.. _youcompleteme: http://valloric.github.io/YouCompleteMe/
.. _Jedi.el: https://github.com/tkf/emacs-jedi
.. _sublimejedi: https://github.com/svaiter/SublimeJEDI
.. _wdb: https://github.com/Kozea/wdb

View File

@@ -45,9 +45,18 @@ Resources
Editor Plugins Editor Plugins
-------------- --------------
- `Vim <http://github.com/davidhalter/jedi-vim>`_ Vim:
- `Emacs <https://github.com/tkf/emacs-jedi>`_
- `Sublime Text 2 <https://github.com/svaiter/SublimeJEDI>`_ - `jedi-vim <http://github.com/davidhalter/jedi-vim>`_
- `YouCompleteMe <http://valloric.github.io/YouCompleteMe/>`_
Emacs:
- `Jedi.el <https://github.com/tkf/emacs-jedi>`_
Sublime Text 2:
- `SublimeJEDI <https://github.com/svaiter/SublimeJEDI>`_
.. _other-software: .. _other-software:

View File

@@ -141,6 +141,7 @@ class ModuleWithCursor(Module):
last_line = self.get_line(self._line_temp) last_line = self.get_line(self._line_temp)
if last_line and last_line[-1] == '\\': if last_line and last_line[-1] == '\\':
line = last_line[:-1] + ' ' + line line = last_line[:-1] + ' ' + line
self._line_length = len(last_line)
else: else:
break break
return line[::-1] return line[::-1]
@@ -187,6 +188,7 @@ class ModuleWithCursor(Module):
elif token_type == tokenize.NUMBER: elif token_type == tokenize.NUMBER:
pass pass
else: else:
self._column_temp = self._line_length - end[1]
break break
self._column_temp = self._line_length - end[1] self._column_temp = self._line_length - end[1]

View File

@@ -127,8 +127,10 @@ cache_directory = os.path.expanduser(_cache_directory)
""" """
The path where all the caches can be found. The path where all the caches can be found.
On Linux, this defaults to ``~/.cache/jedi/``, on OS X to ``~/.jedi/`` and on On Linux, this defaults to ``~/.cache/jedi/``, on OS X to
Windows to ``%APPDATA%\\Jedi\\Jedi\\``. ``~/Library/Caches/Jedi/`` and on Windows to ``%APPDATA%\\Jedi\\Jedi\\``.
On Linux, if environment variable ``$XDG_CACHE_HOME`` is set,
``$XDG_CACHE_HOME/jedi`` is used instead of the default one.
""" """
# ---------------- # ----------------

View File

@@ -86,6 +86,9 @@ class BaseAttacker(object):
return self.record['data'][recid] return self.record['data'][recid]
def save_record(self, path): def save_record(self, path):
directory = os.path.dirname(os.path.abspath(path))
if not os.path.isdir(directory):
os.makedirs(directory)
with open(path, 'w') as f: with open(path, 'w') as f:
json.dump(self.record, f) json.dump(self.record, f)
@@ -251,6 +254,7 @@ class AttackApp(object):
einfo = sys.exc_info() einfo = sys.exc_info()
pdb = __import__(debugger) pdb = __import__(debugger)
pdb.post_mortem(einfo if debugger == 'pudb' else einfo[2]) pdb.post_mortem(einfo if debugger == 'pudb' else einfo[2])
sys.exit(1)
def add_parser(self, attacker_class, *args, **kwds): def add_parser(self, attacker_class, *args, **kwds):
attacker = attacker_class() attacker = attacker_class()

View File

@@ -395,6 +395,43 @@ class TestRegression(TestBase):
for c in s.get_commands(): for c in s.get_commands():
self.assertEqual(c.execution.end_pos[1], i) self.assertEqual(c.execution.end_pos[1], i)
def check_definition_by_marker(self, source, after_cursor, names):
r"""
Find definitions specified by `after_cursor` and check what found
For example, for the following configuration, you can pass
``after_cursor = 'y)'``.::
function(
x, y)
\
`- You want cursor to be here
"""
source = textwrap.dedent(source)
for (i, line) in enumerate(source.splitlines()):
if after_cursor in line:
break
column = len(line) - len(after_cursor)
defs = self.goto_definitions(source, (i + 1, column))
self.assertEqual([d.name for d in defs], names)
def test_backslash_continuation(self):
"""
Test that ModuleWithCursor.get_path_until_cursor handles continuation
"""
self.check_definition_by_marker(r"""
x = 0
a = \
[1, 2, 3, 4, 5, 6, 7, 8, 9, x] # <-- here
""", '] # <-- here', ['int'])
def test_backslash_continuation_and_bracket(self):
self.check_definition_by_marker(r"""
x = 0
a = \
[1, 2, 3, 4, 5, 6, 7, 8, 9, (x)] # <-- here
""", '(x)] # <-- here', [None])
class TestDocstring(TestBase): class TestDocstring(TestBase):

View File

@@ -16,3 +16,8 @@ deps =
commands = commands =
coverage run --source jedi -m py.test coverage run --source jedi -m py.test
coverage report coverage report
[testenv:sith]
deps =
argparse
commands =
{envpython} sith.py --record {envtmpdir}/record.json random {posargs:jedi}