forked from VimPlug/jedi
List allowed attributes in Generator.__getattr__
This commit is contained in:
@@ -769,11 +769,12 @@ class Generator(use_metaclass(cache.CachedMetaClass, pr.Base)):
|
|||||||
debug.warning('Tried to get array access on a generator', self)
|
debug.warning('Tried to get array access on a generator', self)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@property
|
|
||||||
def parent(self):
|
|
||||||
return self.func.parent
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
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)
|
return getattr(self.func, name)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user