forked from VimPlug/jedi
autocompletion diggs now pretty deep for generator objects
This commit is contained in:
@@ -110,4 +110,5 @@ def is_class_instance(obj):
|
|||||||
"""Like inspect.* methods."""
|
"""Like inspect.* methods."""
|
||||||
return not (inspect.isclass(obj) or inspect.ismodule(obj)
|
return not (inspect.isclass(obj) or inspect.ismodule(obj)
|
||||||
or inspect.isbuiltin(obj) or inspect.ismethod(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))
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
# -----------------
|
# -----------------
|
||||||
# yield statement
|
# yield statement
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|
||||||
def gen():
|
def gen():
|
||||||
yield 1
|
yield 1
|
||||||
yield ""
|
yield ""
|
||||||
@@ -13,6 +12,7 @@ next(gen_exe)
|
|||||||
#? int() str() list
|
#? int() str() list
|
||||||
next(gen_exe, list)
|
next(gen_exe, list)
|
||||||
|
|
||||||
|
|
||||||
def gen_ret(value):
|
def gen_ret(value):
|
||||||
yield value
|
yield value
|
||||||
|
|
||||||
@@ -22,6 +22,7 @@ next(gen_ret(1))
|
|||||||
#? []
|
#? []
|
||||||
next(gen_ret())
|
next(gen_ret())
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# generators should not be indexable
|
# generators should not be indexable
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -39,6 +40,7 @@ for a in get():
|
|||||||
#? int() str()
|
#? int() str()
|
||||||
a
|
a
|
||||||
|
|
||||||
|
|
||||||
class Get():
|
class Get():
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
yield 1
|
yield 1
|
||||||
@@ -63,6 +65,7 @@ g = iter([1.0])
|
|||||||
#? float()
|
#? float()
|
||||||
next(g)
|
next(g)
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# __next__
|
# __next__
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -90,6 +93,7 @@ for c in Counter(3, 8):
|
|||||||
#? int()
|
#? int()
|
||||||
print c
|
print c
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# tuples
|
# tuples
|
||||||
# -----------------
|
# -----------------
|
||||||
@@ -113,3 +117,9 @@ b
|
|||||||
# `close` is a method wrapper.
|
# `close` is a method wrapper.
|
||||||
#? ['__call__']
|
#? ['__call__']
|
||||||
gen().close.__call__
|
gen().close.__call__
|
||||||
|
|
||||||
|
#? ['co_consts']
|
||||||
|
gen().gi_code.co_consts
|
||||||
|
|
||||||
|
#? []
|
||||||
|
gen.gi_code.co_consts
|
||||||
|
|||||||
Reference in New Issue
Block a user