1
0
forked from VimPlug/jedi

Trying to get ird of the weird param generation in the parser tree.

This commit is contained in:
Dave Halter
2015-02-10 15:49:26 +01:00
parent 8775d90173
commit cdbe26786a
9 changed files with 71 additions and 72 deletions

View File

@@ -176,7 +176,7 @@ def follow_param(evaluator, param):
return [p
for param_str in _search_param_in_docstr(func.raw_doc,
str(param.get_name()))
str(param.name))
for p in _evaluate_for_statement_string(evaluator, param_str,
param.get_parent_until())]

View File

@@ -59,7 +59,7 @@ def search_params(evaluator, param):
"""
for params in get_posibilities(evaluator, module, func_name):
for p in params:
if str(p) == str(param.get_name()):
if str(p) == str(param.name):
result += p.parent.eval(evaluator)
"""
# Compare the param names.

View File

@@ -82,6 +82,7 @@ class NameFinder(object):
@debug.increase_indent
def find(self, scopes, search_global=False):
# TODO rename scopes to names_dicts
names = self.filter_name(scopes)
types = self._names_to_types(names, search_global)
@@ -109,7 +110,7 @@ class NameFinder(object):
def names_dict_lookup(self, names_dict, position):
def get_param(scope, el):
if isinstance(el.parent, pr.Param) or isinstance(el.parent.parent, pr.Param):
if isinstance(el.get_parent_until(pr.Param), pr.Param):
return scope.param_by_name(str(el))
return el
@@ -331,7 +332,7 @@ def _remove_statements(evaluator, stmt, name):
def _eval_param(evaluator, param, scope):
res_new = []
func = param.parent
func = param.get_parent_scope()
cls = func.parent.get_parent_until((pr.Class, pr.Function))

View File

@@ -70,7 +70,7 @@ def deep_ast_copy(obj, new_elements_default=None, check_first=False):
setattr(new_obj, key, new_elements[value])
except KeyError:
unfinished_parents.append(new_obj)
elif key in ['parent_function', 'use_as_parent', '_sub_module']:
elif key == 'position_modifier':
continue
elif key == 'names_dict':
d = dict((k, sequence_recursion(v)) for k, v in value.items())

View File

@@ -199,7 +199,7 @@ def get_params(evaluator, func, var_args):
param_names = []
param_dict = {}
for param in func.params:
param_dict[str(param.get_name())] = param
param_dict[str(param.name)] = param
unpacked_va = list(var_args.unpack(func))
from jedi.evaluate.representation import InstanceElement
if isinstance(func, InstanceElement):
@@ -279,7 +279,7 @@ def get_params(evaluator, func, var_args):
# Now add to result if it's not one of the previously covered cases.
if (not keys_only or param.stars == 2):
param_names.append(ExecutedParam(param, var_args, values).name)
keys_used[unicode(param.get_name())] = param_names[-1]
keys_used[unicode(param.name)] = param_names[-1]
if keys_only:
# All arguments should be handed over to the next function. It's not

View File

@@ -140,7 +140,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
normally self.
"""
try:
return str(func.params[0].get_name())
return str(func.params[0].name)
except IndexError:
return None