mirror of
https://github.com/davidhalter/jedi.git
synced 2026-08-18 06:07:59 +08:00
Cleaning up.
This commit is contained in:
@@ -273,13 +273,11 @@ def get_instance_el(evaluator, instance, var, is_class_var=False):
|
|||||||
Returns an InstanceElement if it makes sense, otherwise leaves the object
|
Returns an InstanceElement if it makes sense, otherwise leaves the object
|
||||||
untouched.
|
untouched.
|
||||||
"""
|
"""
|
||||||
if isinstance(var, (Instance, compiled.CompiledObject, pr.Leaf,
|
if isinstance(var, pr.Name):
|
||||||
pr.Module, FunctionExecution, pr.Name)):
|
parent = get_instance_el(evaluator, instance, var.parent, is_class_var)
|
||||||
if isinstance(var, pr.Name):
|
return InstanceName(var, parent)
|
||||||
# TODO temp solution, remove later, Name should never get
|
elif isinstance(var, (Instance, compiled.CompiledObject, pr.Leaf,
|
||||||
# here?
|
pr.Module, FunctionExecution)):
|
||||||
parent = get_instance_el(evaluator, instance, var.parent, is_class_var)
|
|
||||||
return InstanceName(var, parent)
|
|
||||||
return var
|
return var
|
||||||
|
|
||||||
var = wrap(evaluator, var)
|
var = wrap(evaluator, var)
|
||||||
@@ -311,9 +309,6 @@ class InstanceElement(use_metaclass(CachedMetaClass, pr.Base)):
|
|||||||
return par
|
return par
|
||||||
|
|
||||||
def get_parent_until(self, *args, **kwargs):
|
def get_parent_until(self, *args, **kwargs):
|
||||||
if isinstance(self.var, pr.Name):
|
|
||||||
# TODO Name should never even be InstanceElements
|
|
||||||
return pr.Simple.get_parent_until(self.parent, *args, **kwargs)
|
|
||||||
return pr.Simple.get_parent_until(self, *args, **kwargs)
|
return pr.Simple.get_parent_until(self, *args, **kwargs)
|
||||||
|
|
||||||
def get_definition(self):
|
def get_definition(self):
|
||||||
@@ -670,18 +665,6 @@ class FunctionExecution(Executed):
|
|||||||
def yields(self):
|
def yields(self):
|
||||||
return self._copy_list(self.base.yields)
|
return self._copy_list(self.base.yields)
|
||||||
|
|
||||||
"""
|
|
||||||
@common.safe_property
|
|
||||||
@memoize_default([])
|
|
||||||
def children(self):
|
|
||||||
helpers.deep_ast_copy(self.base.base_func, self._copy_dict, check_first=True)
|
|
||||||
if isinstance(self.base, InstanceElement):
|
|
||||||
children = self.base.var.children
|
|
||||||
else:
|
|
||||||
children = self.base.children
|
|
||||||
return self._copy_list(children)
|
|
||||||
"""
|
|
||||||
|
|
||||||
@common.safe_property
|
@common.safe_property
|
||||||
@memoize_default([])
|
@memoize_default([])
|
||||||
def asserts(self):
|
def asserts(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user