forked from VimPlug/jedi
add __iter__method to InstanceElement, because it's needed for arrays
This commit is contained in:
@@ -220,6 +220,10 @@ class InstanceElement(use_metaclass(cache.CachedMetaClass, pr.Base)):
|
||||
if not isinstance(command, unicode) else command
|
||||
for command in self.var.get_commands()]
|
||||
|
||||
def __iter__(self):
|
||||
for el in self.var.__iter__():
|
||||
yield InstanceElement(self.instance, el, self.is_class_var)
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self.var, name)
|
||||
|
||||
|
||||
@@ -1260,9 +1260,11 @@ class Array(Call):
|
||||
This is not only used for calls on the actual object, but for
|
||||
ducktyping, to invoke this function with anything as `self`.
|
||||
"""
|
||||
if isinstance(instance, Array):
|
||||
try:
|
||||
if instance.type in types:
|
||||
return True
|
||||
except AttributeError:
|
||||
pass
|
||||
return False
|
||||
|
||||
def __len__(self):
|
||||
|
||||
@@ -154,9 +154,9 @@ def a(): return ''
|
||||
|
||||
class C():
|
||||
def __init__(self):
|
||||
self.a = (int(1)).real
|
||||
self.a = (str()).upper()
|
||||
|
||||
#? int()
|
||||
#? str()
|
||||
C().a
|
||||
|
||||
# -----------------
|
||||
|
||||
Reference in New Issue
Block a user