1
0
forked from VimPlug/jedi

Merge pull request #177 from tkf/Generator-object-has-no-attribute-start_pos

Generator object has no attribute start_pos (added a failing test)
This commit is contained in:
David Halter
2013-03-21 11:06:21 -07:00
2 changed files with 9 additions and 5 deletions
+7 -3
View File
@@ -769,9 +769,13 @@ class Generator(use_metaclass(cache.CachedMetaClass, pr.Base)):
debug.warning('Tried to get array access on a generator', self)
return []
@property
def parent(self):
return self.func.parent
def __getattr__(self, name):
if name not in ['start_pos', 'end_pos', 'parent', 'get_imports',
'asserts', 'doc', 'docstr', 'get_parent_until', 'get_code',
'subscopes']:
raise AttributeError("Accessing %s of %s is not allowed."
% (self, name))
return getattr(self.func, name)
def __repr__(self):
return "<%s of %s>" % (type(self).__name__, self.func)