1
0
forked from VimPlug/jedi

autocompletion diggs now pretty deep for generator objects

This commit is contained in:
Dave Halter
2014-01-23 14:39:00 +01:00
parent a1b68945ed
commit 6f2c1397b0
2 changed files with 13 additions and 2 deletions

View File

@@ -110,4 +110,5 @@ def is_class_instance(obj):
"""Like inspect.* methods."""
return not (inspect.isclass(obj) or inspect.ismodule(obj)
or inspect.isbuiltin(obj) or inspect.ismethod(obj)
or inspect.ismethoddescriptor(obj))
or inspect.ismethoddescriptor(obj) or inspect.iscode(obj)
or inspect.isgenerator(obj))

View File

@@ -1,7 +1,6 @@
# -----------------
# yield statement
# -----------------
def gen():
yield 1
yield ""
@@ -13,6 +12,7 @@ next(gen_exe)
#? int() str() list
next(gen_exe, list)
def gen_ret(value):
yield value
@@ -22,6 +22,7 @@ next(gen_ret(1))
#? []
next(gen_ret())
# -----------------
# generators should not be indexable
# -----------------
@@ -39,6 +40,7 @@ for a in get():
#? int() str()
a
class Get():
def __iter__(self):
yield 1
@@ -63,6 +65,7 @@ g = iter([1.0])
#? float()
next(g)
# -----------------
# __next__
# -----------------
@@ -90,6 +93,7 @@ for c in Counter(3, 8):
#? int()
print c
# -----------------
# tuples
# -----------------
@@ -113,3 +117,9 @@ b
# `close` is a method wrapper.
#? ['__call__']
gen().close.__call__
#? ['co_consts']
gen().gi_code.co_consts
#? []
gen.gi_code.co_consts