1
0
forked from VimPlug/jedi

Do not use >>> for non-doctest code example

Use literal block instead.
This commit is contained in:
Takafumi Arakaki
2013-02-26 10:36:08 +01:00
parent dad9cf0518
commit 95a98c9033
6 changed files with 27 additions and 24 deletions

View File

@@ -360,11 +360,11 @@ class Script(object):
E.g. if the cursor is here:: 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:: This would return the ``abs`` function. On the other hand::
>>> abs()# <-- cursor is here abs()# <-- cursor is here
This would return ``None``. This would return ``None``.

View File

@@ -187,7 +187,7 @@ class Completion(BaseDefinition):
""" """
Return the rest of the word, e.g. completing ``isinstance``:: 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 would return the string 'ce'. It also adds additional stuff, depending
on your `settings.py`. on your `settings.py`.
@@ -211,7 +211,7 @@ class Completion(BaseDefinition):
Similar to :meth:`Completion.complete`, but return the whole word, for Similar to :meth:`Completion.complete`, but return the whole word, for
example:: example::
>>> isinstan isinstan
would return 'isinstance'. would return 'isinstance'.
""" """

View File

@@ -26,11 +26,11 @@ Parameter completion
******************** ********************
One of the really important features of |jedi| is to have an option to 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): def foo(bar):
>>> bar. # completion here bar. # completion here
>>> foo(1) foo(1)
There's no doubt wheter bar is an ``int`` or not, but if there's also a call 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 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): def check_flow_information(flow, search_name, pos):
""" Try to find out the type of a variable just with the information that """ 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. is given by the flows: e.g. It is also responsible for assert checks.::
>>> if isinstance(k, str):
>>> k. # <- completion here if isinstance(k, str):
k. # <- completion here
ensures that `k` is a string. ensures that `k` is a string.
""" """

View File

@@ -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. 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 Therefore you need to understand what follows after ``follow_statement``. Let's
make an example: make an example::
>>> import datetime import datetime
>>> datetime.date.toda# <-- cursor here datetime.date.toda# <-- cursor here
First of all, this module doesn't care about completion. It really just cares 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 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 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 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 from foo import bar
>>> Date = bar.baz Date = bar.baz
Well... You get it. Just another ``follow_statement`` recursion. It's really Well... You get it. Just another ``follow_statement`` recursion. It's really
easy. Just that Python is not that easy sometimes. To understand tuple 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): def follow_path(path, scope, call_scope, position=None):
""" """
Uses a generator and tries to complete the path, e.g. Uses a generator and tries to complete the path, e.g.::
>>> foo.bar.baz
foo.bar.baz
`follow_path` is only responsible for completing `.bar.baz`, the rest is `follow_path` is only responsible for completing `.bar.baz`, the rest is
done in the `follow_call` function. done in the `follow_call` function.

View File

@@ -84,8 +84,9 @@ class ImportPath(pr.Base):
def is_nested_import(self): def is_nested_import(self):
""" """
This checks for the special case of nested imports, without aliases and This checks for the special case of nested imports, without aliases and
from statement: from statement::
>>> import foo.bar
import foo.bar
""" """
return not self.import_stmt.alias and not self.import_stmt.from_ns \ return not self.import_stmt.alias and not self.import_stmt.from_ns \
and len(self.import_stmt.namespace.names) > 1 \ and len(self.import_stmt.namespace.names) > 1 \

View File

@@ -299,10 +299,10 @@ class Parser(object):
def _parse_statement(self, pre_used_token=None, added_breaks=None, def _parse_statement(self, pre_used_token=None, added_breaks=None,
stmt_class=pr.Statement): stmt_class=pr.Statement):
""" """
Parses statements like: Parses statements like::
>>> a = test(b) a = test(b)
>>> a += 3 - 2 or b a += 3 - 2 or b
and so on. One line at a time. and so on. One line at a time.