def create(evaluator, obj, parent_context=None, *args): tree_node, path = find_syntax_node_name(evaluator, obj) compiled_object = compiled.create( evaluator, obj, parent_context=parent_context.compiled_object) if tree_node is None: return compiled_object module_node = tree_node.get_root_node() if parent_context.tree_node.get_root_node() == module_node: module_context = parent_context.get_root_context() else: from jedi.evaluate.representation import ModuleContext module_context = ModuleContext(evaluator, module_node, path=path) name = compiled_object.get_root_context().py__name__() imports.add_module(evaluator, name, module_context) tree_context = module_context.create_context(tree_node, node_is_context=True, node_is_object=True) return MixedObject(evaluator, parent_context, compiled_object, tree_context=tree_context)
def create(evaluator, obj, parent_context=None, *args): tree_node, path = find_syntax_node_name(evaluator, obj) compiled_object = compiled.create( evaluator, obj, parent_context=parent_context.compiled_object) if tree_node is None: return compiled_object module_node = tree_node.get_root_node() if parent_context.tree_node.get_root_node() == module_node: module_context = parent_context.get_root_context() else: from jedi.evaluate.representation import ModuleContext module_context = ModuleContext(evaluator, module_node, path=path) name = compiled_object.get_root_context().py__name__() imports.add_module(evaluator, name, module_context) tree_context = module_context.create_context( tree_node, node_is_context=True, node_is_object=True ) return MixedObject( evaluator, parent_context, compiled_object, tree_context=tree_context )
def _create(evaluator, obj, parent_context=None, *args): tree_node, path = find_syntax_node_name(evaluator, obj) compiled_object = compiled.create( evaluator, obj, parent_context=parent_context.compiled_object) if tree_node is None: return compiled_object module_node = tree_node.get_root_node() if parent_context.tree_node.get_root_node() == module_node: module_context = parent_context.get_root_context() else: from jedi.evaluate.representation import ModuleContext module_context = ModuleContext(evaluator, module_node, path=path) # TODO this __name__ is probably wrong. name = compiled_object.get_root_context().py__name__() imports.add_module(evaluator, name, module_context) tree_context = module_context.create_context(tree_node, node_is_context=True, node_is_object=True) if tree_node.type == 'classdef': if not inspect.isclass(obj): # Is an instance, not a class. tree_context, = tree_context.execute_evaluated() return MixedObject(evaluator, parent_context, compiled_object, tree_context=tree_context)
def _create(evaluator, obj, parent_context=None, *args): tree_node, path = find_syntax_node_name(evaluator, obj) compiled_object = compiled.create( evaluator, obj, parent_context=parent_context.compiled_object) if tree_node is None: return compiled_object module_node = tree_node.get_root_node() if parent_context.tree_node.get_root_node() == module_node: module_context = parent_context.get_root_context() else: from jedi.evaluate.representation import ModuleContext module_context = ModuleContext(evaluator, module_node, path=path) # TODO this __name__ is probably wrong. name = compiled_object.get_root_context().py__name__() imports.add_module(evaluator, name, module_context) tree_context = module_context.create_context( tree_node, node_is_context=True, node_is_object=True ) if tree_node.type == 'classdef': if not inspect.isclass(obj): # Is an instance, not a class. tree_context, = tree_context.execute_evaluated() return MixedObject( evaluator, parent_context, compiled_object, tree_context=tree_context )
def __init__(self, evaluator, parent_context, compiled_object, tree_name): self.evaluator = evaluator self.compiled_object = compiled_object self.obj = compiled_object.obj self._tree_name = tree_name name_module = tree_name.get_root_node() if parent_context.tree_node.get_root_node() != name_module: from jedi.evaluate.representation import ModuleContext module_context = ModuleContext(evaluator, name_module) name = compiled_object.get_root_context().py__name__() imports.add_module(evaluator, name, module_context) else: module_context = parent_context.get_root_context() self._context = module_context.create_context(tree_name.parent, node_is_context=True, node_is_object=True)
def __init__(self, evaluator, parent_context, compiled_object, tree_name): self.evaluator = evaluator self.compiled_object = compiled_object self.obj = compiled_object.obj self._tree_name = tree_name name_module = tree_name.get_root_node() if parent_context.tree_node.get_root_node() != name_module: from jedi.evaluate.representation import ModuleContext module_context = ModuleContext(evaluator, name_module) name = compiled_object.get_root_context().py__name__() imports.add_module(evaluator, name, module_context) else: module_context = parent_context.get_root_context() self._context = module_context.create_context( tree_name.parent, node_is_context=True, node_is_object=True )