mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-26 07:08:18 +08:00
Improve api.Interpreter docstring
This commit is contained in:
16
jedi/api.py
16
jedi/api.py
@@ -508,10 +508,16 @@ class Interpreter(Script):
|
|||||||
"""
|
"""
|
||||||
Jedi API for Python REPLs.
|
Jedi API for Python REPLs.
|
||||||
|
|
||||||
>>> from itertools import chain
|
In addition to completion of simple attribute access, Jedi
|
||||||
>>> script = Interpreter('cha', [locals()])
|
supports code completion based on static code analysis.
|
||||||
>>> script.complete()
|
Jedi can complete attributes of object which is not initialized
|
||||||
[<Completion: chain>]
|
yet.
|
||||||
|
|
||||||
|
>>> from os.path import join
|
||||||
|
>>> namespace = locals()
|
||||||
|
>>> script = Interpreter('join().up', [namespace])
|
||||||
|
>>> print(script.complete()[0].word)
|
||||||
|
upper
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -529,7 +535,7 @@ class Interpreter(Script):
|
|||||||
for (variable, obj) in raw_namespace.items():
|
for (variable, obj) in raw_namespace.items():
|
||||||
try:
|
try:
|
||||||
module = obj.__module__
|
module = obj.__module__
|
||||||
except:
|
except AttributeError:
|
||||||
continue
|
continue
|
||||||
fakeimport = self._make_fakeimport(variable, module)
|
fakeimport = self._make_fakeimport(variable, module)
|
||||||
self._parser.scope.imports.append(fakeimport)
|
self._parser.scope.imports.append(fakeimport)
|
||||||
|
|||||||
Reference in New Issue
Block a user