1
0
forked from VimPlug/jedi

Remove the module path from the parser tree.

Some static analysis tests are still failing.
This commit is contained in:
Dave Halter
2017-03-27 18:13:32 +02:00
parent b60ec024fa
commit 8a35a04439
14 changed files with 102 additions and 101 deletions

View File

@@ -142,7 +142,11 @@ class Script(object):
@cache.memoize_method
def _get_module(self):
module = er.ModuleContext(self._evaluator, self._get_module_node())
module = er.ModuleContext(
self._evaluator,
self._get_module_node(),
self.path
)
imports.add_module(self._evaluator, module.name.string_name, module)
return module
@@ -398,7 +402,8 @@ class Interpreter(Script):
return interpreter.MixedModuleContext(
self._evaluator,
parser_module,
self.namespaces
self.namespaces,
path=self.path
)

View File

@@ -300,7 +300,7 @@ def cache_call_signatures(evaluator, context, bracket_leaf, code_lines, user_pos
whole = '\n'.join(other_lines + [before_cursor])
before_bracket = re.match(r'.*\(', whole, re.DOTALL)
module_path = bracket_leaf.get_root_node().path
module_path = context.get_root_context().py__file__()
if module_path is None:
yield None # Don't cache!
else:

View File

@@ -12,12 +12,12 @@ class MixedModuleContext(Context):
resets_positions = True
type = 'mixed_module'
def __init__(self, evaluator, tree_module, namespaces):
def __init__(self, evaluator, tree_module, namespaces, path):
self.evaluator = evaluator
self._namespaces = namespaces
self._namespace_objects = [type('jedi_namespace', (), n) for n in namespaces]
self._module_context = ModuleContext(evaluator, tree_module)
self._module_context = ModuleContext(evaluator, tree_module, path=path)
self.tree_node = tree_module
def get_node(self):
@@ -33,7 +33,7 @@ class MixedModuleContext(Context):
self.evaluator,
parent_context=self,
compiled_object=compiled_object,
tree_name=self.tree_node.name
tree_context=self._module_context
)
for filter in mixed_object.get_filters(*args, **kwargs):
yield filter