forked from VimPlug/jedi
Fix issues with module attributes
This commit is contained in:
@@ -88,7 +88,7 @@ class NameFinder(object):
|
||||
# Just calculate the scope from the first
|
||||
stmt = names[0].get_definition()
|
||||
scope = stmt.get_parent_scope()
|
||||
if isinstance(stmt, (pr.CompFor, pr.Lambda)):
|
||||
if isinstance(stmt, (pr.CompFor, pr.Lambda, pr.GlobalStmt)):
|
||||
return names
|
||||
|
||||
# Private name mangling (compile.c) disallows access on names
|
||||
|
||||
@@ -211,8 +211,8 @@ class FakeName(pr.Name):
|
||||
|
||||
|
||||
class LazyName(FakeName):
|
||||
def __init__(self, name, parent_callback):
|
||||
super(LazyName, self).__init__(name)
|
||||
def __init__(self, name, parent_callback, is_definition=None):
|
||||
super(LazyName, self).__init__(name, is_definition=is_definition)
|
||||
self._parent_callback = parent_callback
|
||||
|
||||
@property
|
||||
|
||||
@@ -848,7 +848,8 @@ class ModuleWrapper(use_metaclass(CachedMetaClass, pr.Module, Wrapper)):
|
||||
|
||||
names = ['__file__', '__package__', '__doc__', '__name__']
|
||||
# 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()
|
||||
def _module_attributes(self):
|
||||
|
||||
Reference in New Issue
Block a user