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=py33
- TOXENV=cov
- TOXENV=sith
matrix:
allow_failures:
- env: TOXENV=cov
- env: TOXENV=sith
install:
- pip install --quiet --use-mirrors tox
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
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>`_
- `Emacs-Plugin <https://github.com/tkf/emacs-jedi>`_
- `Sublime-Plugin <https://github.com/svaiter/SublimeJEDI>`_
- `wdb (web debugger) <https://github.com/Kozea/wdb>`_
- Vim (jedi-vim_, YouCompleteMe_)
- Emacs (Jedi.el_)
- Sublime Text (SublimeJEDI_)
And it powers the following projects:
- wdb_
Here are some pictures:
@@ -123,3 +126,10 @@ Tests are also run automatically on `Travis CI
For more detailed information visit the `testing documentation
<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
--------------
- `Vim <http://github.com/davidhalter/jedi-vim>`_
- `Emacs <https://github.com/tkf/emacs-jedi>`_
- `Sublime Text 2 <https://github.com/svaiter/SublimeJEDI>`_
Vim:
- `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:

View File

@@ -141,6 +141,7 @@ class ModuleWithCursor(Module):
last_line = self.get_line(self._line_temp)
if last_line and last_line[-1] == '\\':
line = last_line[:-1] + ' ' + line
self._line_length = len(last_line)
else:
break
return line[::-1]
@@ -187,6 +188,7 @@ class ModuleWithCursor(Module):
elif token_type == tokenize.NUMBER:
pass
else:
self._column_temp = self._line_length - end[1]
break
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.
On Linux, this defaults to ``~/.cache/jedi/``, on OS X to ``~/.jedi/`` and on
Windows to ``%APPDATA%\\Jedi\\Jedi\\``.
On Linux, this defaults to ``~/.cache/jedi/``, on OS X to
``~/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]
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:
json.dump(self.record, f)
@@ -251,6 +254,7 @@ class AttackApp(object):
einfo = sys.exc_info()
pdb = __import__(debugger)
pdb.post_mortem(einfo if debugger == 'pudb' else einfo[2])
sys.exit(1)
def add_parser(self, attacker_class, *args, **kwds):
attacker = attacker_class()

View File

@@ -395,6 +395,43 @@ class TestRegression(TestBase):
for c in s.get_commands():
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):

View File

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