diff --git a/docs/docs/api.rst b/docs/docs/api.rst index e1002682..17d333d1 100644 --- a/docs/docs/api.rst +++ b/docs/docs/api.rst @@ -72,15 +72,16 @@ Errors Examples -------- -Completions: +Completions +~~~~~~~~~~~ .. sourcecode:: python >>> import jedi - >>> source = '''import json; json.l''' - >>> script = jedi.Script(source, path='') + >>> code = '''import json; json.l''' + >>> script = jedi.Script(code, path='example.py') >>> script - + > >>> completions = script.complete(1, 19) >>> completions [, ] @@ -91,12 +92,13 @@ Completions: >>> completions[1].name 'loads' -Definitions / Goto: +Type Inference / Goto +~~~~~~~~~~~~~~~~~~~~~ .. sourcecode:: python >>> import jedi - >>> source = '''def my_func(): + >>> code = '''def my_func(): ... print 'called' ... ... alias = my_func @@ -104,25 +106,26 @@ Definitions / Goto: ... inception = my_list[2] ... ... inception()''' - >>> script = jedi.Script(source, path='') + >>> script = jedi.Script(code) >>> >>> script.goto(8, 1) - [] + [] >>> >>> script.infer(8, 1) - [] + [] -References: +References +~~~~~~~~~~ .. sourcecode:: python >>> import jedi - >>> source = '''x = 3 + >>> code = '''x = 3 ... if 1 == 2: ... x = 4 ... else: ... del x''' - >>> script = jedi.Script(source, '') + >>> script = jedi.Script(code) >>> rns = script.get_references(5, 8) >>> rns [,