forked from VimPlug/jedi
Do not use >>> for non-doctest code example
Use literal block instead.
This commit is contained in:
@@ -360,11 +360,11 @@ class Script(object):
|
||||
|
||||
E.g. if the cursor is here::
|
||||
|
||||
>>> abs(# <-- cursor is here
|
||||
abs(# <-- cursor is here
|
||||
|
||||
This would return the ``abs`` function. On the other hand::
|
||||
|
||||
>>> abs()# <-- cursor is here
|
||||
abs()# <-- cursor is here
|
||||
|
||||
This would return ``None``.
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ class Completion(BaseDefinition):
|
||||
"""
|
||||
Return the rest of the word, e.g. completing ``isinstance``::
|
||||
|
||||
>>> isinstan# <-- Cursor is here
|
||||
isinstan# <-- Cursor is here
|
||||
|
||||
would return the string 'ce'. It also adds additional stuff, depending
|
||||
on your `settings.py`.
|
||||
@@ -211,7 +211,7 @@ class Completion(BaseDefinition):
|
||||
Similar to :meth:`Completion.complete`, but return the whole word, for
|
||||
example::
|
||||
|
||||
>>> isinstan
|
||||
isinstan
|
||||
|
||||
would return 'isinstance'.
|
||||
"""
|
||||
|
||||
@@ -26,11 +26,11 @@ Parameter completion
|
||||
********************
|
||||
|
||||
One of the really important features of |jedi| is to have an option to
|
||||
understand code like this:
|
||||
understand code like this::
|
||||
|
||||
>>> def foo(bar):
|
||||
>>> bar. # completion here
|
||||
>>> foo(1)
|
||||
def foo(bar):
|
||||
bar. # completion here
|
||||
foo(1)
|
||||
|
||||
There's no doubt wheter bar is an ``int`` or not, but if there's also a call
|
||||
like ``foo('str')``, what would happen? Well, we'll just show both. Because
|
||||
@@ -496,9 +496,10 @@ def related_name_add_import_modules(definitions, search_name):
|
||||
|
||||
def check_flow_information(flow, search_name, pos):
|
||||
""" Try to find out the type of a variable just with the information that
|
||||
is given by the flows: e.g. It is also responsible for assert checks.
|
||||
>>> if isinstance(k, str):
|
||||
>>> k. # <- completion here
|
||||
is given by the flows: e.g. It is also responsible for assert checks.::
|
||||
|
||||
if isinstance(k, str):
|
||||
k. # <- completion here
|
||||
|
||||
ensures that `k` is a string.
|
||||
"""
|
||||
|
||||
@@ -16,10 +16,10 @@ This is where autocompletion starts. Everything you want to complete is either
|
||||
a ``Statement`` or some special name like ``class``, which is easy to complete.
|
||||
|
||||
Therefore you need to understand what follows after ``follow_statement``. Let's
|
||||
make an example:
|
||||
make an example::
|
||||
|
||||
>>> import datetime
|
||||
>>> datetime.date.toda# <-- cursor here
|
||||
import datetime
|
||||
datetime.date.toda# <-- cursor here
|
||||
|
||||
First of all, this module doesn't care about completion. It really just cares
|
||||
about ``datetime.date``. At the end of the procedure ``follow_statement`` will
|
||||
@@ -45,10 +45,10 @@ the datetime import. So it continues
|
||||
|
||||
Now what would happen if we wanted ``datetime.date.foo.bar``? Just two more
|
||||
calls to ``follow_paths`` (which calls itself with a recursion). What if the
|
||||
import would contain another Statement like this:
|
||||
import would contain another Statement like this::
|
||||
|
||||
>>> from foo import bar
|
||||
>>> Date = bar.baz
|
||||
from foo import bar
|
||||
Date = bar.baz
|
||||
|
||||
Well... You get it. Just another ``follow_statement`` recursion. It's really
|
||||
easy. Just that Python is not that easy sometimes. To understand tuple
|
||||
@@ -681,8 +681,9 @@ def follow_paths(path, results, call_scope, position=None):
|
||||
|
||||
def follow_path(path, scope, call_scope, position=None):
|
||||
"""
|
||||
Uses a generator and tries to complete the path, e.g.
|
||||
>>> foo.bar.baz
|
||||
Uses a generator and tries to complete the path, e.g.::
|
||||
|
||||
foo.bar.baz
|
||||
|
||||
`follow_path` is only responsible for completing `.bar.baz`, the rest is
|
||||
done in the `follow_call` function.
|
||||
|
||||
@@ -84,8 +84,9 @@ class ImportPath(pr.Base):
|
||||
def is_nested_import(self):
|
||||
"""
|
||||
This checks for the special case of nested imports, without aliases and
|
||||
from statement:
|
||||
>>> import foo.bar
|
||||
from statement::
|
||||
|
||||
import foo.bar
|
||||
"""
|
||||
return not self.import_stmt.alias and not self.import_stmt.from_ns \
|
||||
and len(self.import_stmt.namespace.names) > 1 \
|
||||
|
||||
@@ -299,10 +299,10 @@ class Parser(object):
|
||||
def _parse_statement(self, pre_used_token=None, added_breaks=None,
|
||||
stmt_class=pr.Statement):
|
||||
"""
|
||||
Parses statements like:
|
||||
Parses statements like::
|
||||
|
||||
>>> a = test(b)
|
||||
>>> a += 3 - 2 or b
|
||||
a = test(b)
|
||||
a += 3 - 2 or b
|
||||
|
||||
and so on. One line at a time.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user