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