forked from VimPlug/jedi
fixes for the interpreter stuff, py27 works now fine
This commit is contained in:
@@ -67,6 +67,8 @@ class LazyName(helpers.FakeName):
|
||||
# cut the `c` from `.pyc`
|
||||
with open(path[:-1]) as f:
|
||||
mod = FastParser(f.read(), path[:-1]).module
|
||||
if not parser_path:
|
||||
return mod
|
||||
found = self._evaluator.eval_call_path(iter(parser_path), mod, None)
|
||||
if found:
|
||||
return found[0]
|
||||
@@ -83,4 +85,6 @@ class LazyName(helpers.FakeName):
|
||||
|
||||
def create(evaluator, namespace, parser_module):
|
||||
ns = InterpreterNamespace(evaluator, namespace, parser_module)
|
||||
parser_module.statements[0].parent = ns
|
||||
for attr_name in pr.SCOPE_CONTENTS:
|
||||
for something in getattr(parser_module, attr_name):
|
||||
something.parent = ns
|
||||
|
||||
@@ -89,7 +89,7 @@ class CompiledObject(Base):
|
||||
return
|
||||
for name in self._parse_function_doc()[1].split():
|
||||
try:
|
||||
bltn_obj = create_from_name(builtin, builtin, name)
|
||||
bltn_obj = _create_from_name(builtin, builtin, name)
|
||||
except AttributeError:
|
||||
continue
|
||||
else:
|
||||
@@ -141,7 +141,7 @@ class CompiledName(object):
|
||||
@underscore_memoization
|
||||
def parent(self):
|
||||
module = self._obj.get_parent_until()
|
||||
return create_from_name(module, self._obj, self.name)
|
||||
return _create_from_name(module, self._obj, self.name)
|
||||
|
||||
@property
|
||||
def names(self):
|
||||
@@ -268,7 +268,7 @@ builtin = Builtin(_builtins)
|
||||
magic_function_class = CompiledObject(type(load_module), parent=builtin)
|
||||
|
||||
|
||||
def create_from_name(module, parent, name):
|
||||
def _create_from_name(module, parent, name):
|
||||
faked = fake.get_faked(module.obj, parent.obj, name)
|
||||
# only functions are necessary.
|
||||
if faked is not None:
|
||||
|
||||
@@ -14,9 +14,6 @@ from jedi.parser import tokenize
|
||||
from jedi import cache
|
||||
|
||||
|
||||
SCOPE_CONTENTS = ['asserts', 'subscopes', 'imports', 'statements', 'returns']
|
||||
|
||||
|
||||
class Module(pr.Simple, pr.Module):
|
||||
def __init__(self, parsers):
|
||||
super(Module, self).__init__(self, (1, 0))
|
||||
@@ -91,7 +88,7 @@ class ParserNode(object):
|
||||
|
||||
scope = self.content_scope
|
||||
self._contents = {}
|
||||
for c in SCOPE_CONTENTS:
|
||||
for c in pr.SCOPE_CONTENTS:
|
||||
self._contents[c] = list(getattr(scope, c))
|
||||
self._is_generator = scope.is_generator
|
||||
|
||||
@@ -142,7 +139,7 @@ class ParserNode(object):
|
||||
def _set_items(self, parser, set_parent=False):
|
||||
# insert parser objects into current structure
|
||||
scope = self.content_scope
|
||||
for c in SCOPE_CONTENTS:
|
||||
for c in pr.SCOPE_CONTENTS:
|
||||
content = getattr(scope, c)
|
||||
items = getattr(parser.module, c)
|
||||
if set_parent:
|
||||
|
||||
@@ -44,6 +44,8 @@ from jedi import debug
|
||||
from jedi import cache
|
||||
from jedi.parser import tokenize
|
||||
|
||||
SCOPE_CONTENTS = ['asserts', 'subscopes', 'imports', 'statements', 'returns']
|
||||
|
||||
|
||||
class Base(object):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user