1
0
forked from VimPlug/jedi

Fix issues with module attributes

This commit is contained in:
Dave Halter
2015-01-06 01:12:55 +01:00
parent 7abdbb563c
commit 8bad12522a
3 changed files with 5 additions and 4 deletions

View File

@@ -88,7 +88,7 @@ class NameFinder(object):
# Just calculate the scope from the first # Just calculate the scope from the first
stmt = names[0].get_definition() stmt = names[0].get_definition()
scope = stmt.get_parent_scope() scope = stmt.get_parent_scope()
if isinstance(stmt, (pr.CompFor, pr.Lambda)): if isinstance(stmt, (pr.CompFor, pr.Lambda, pr.GlobalStmt)):
return names return names
# Private name mangling (compile.c) disallows access on names # Private name mangling (compile.c) disallows access on names

View File

@@ -211,8 +211,8 @@ class FakeName(pr.Name):
class LazyName(FakeName): class LazyName(FakeName):
def __init__(self, name, parent_callback): def __init__(self, name, parent_callback, is_definition=None):
super(LazyName, self).__init__(name) super(LazyName, self).__init__(name, is_definition=is_definition)
self._parent_callback = parent_callback self._parent_callback = parent_callback
@property @property

View File

@@ -848,7 +848,8 @@ class ModuleWrapper(use_metaclass(CachedMetaClass, pr.Module, Wrapper)):
names = ['__file__', '__package__', '__doc__', '__name__'] names = ['__file__', '__package__', '__doc__', '__name__']
# All the additional module attributes are strings. # All the additional module attributes are strings.
return dict((n, [helpers.LazyName(n, parent_callback)]) for n in names) return dict((n, [helpers.LazyName(n, parent_callback, is_definition=True)])
for n in names)
@memoize_default() @memoize_default()
def _module_attributes(self): def _module_attributes(self):