forked from VimPlug/jedi
Fix __getattribute__ and __getattr__.
This commit is contained in:
@@ -26,7 +26,8 @@ class Context(object):
|
||||
Execute a function with already executed arguments.
|
||||
"""
|
||||
from jedi.evaluate.param import ValuesArguments
|
||||
return self.execute(ValuesArguments(value_list))
|
||||
arguments = ValuesArguments([[value] for value in value_list])
|
||||
return self.execute(arguments)
|
||||
|
||||
def eval_node(self, node):
|
||||
return self.evaluator.eval_element(self, node)
|
||||
|
||||
@@ -73,9 +73,8 @@ class AbstractInstanceContext(Context):
|
||||
|
||||
def execute_function_slots(self, names, *evaluated_args):
|
||||
return unite(
|
||||
self.execute_evaluated(method, *evaluated_args)
|
||||
name.execute_evaluated(*evaluated_args)
|
||||
for name in names
|
||||
for method in name.infer()
|
||||
)
|
||||
|
||||
def get_descriptor_returns(self, obj):
|
||||
@@ -208,7 +207,7 @@ class CompiledInstanceClassFilter(compiled.CompiledObjectFilter):
|
||||
for name in names]
|
||||
|
||||
|
||||
class BoundMethod(object):
|
||||
class BoundMethod(Context):
|
||||
def __init__(self, instance, class_context, function):
|
||||
self._instance = instance
|
||||
self._class_context = class_context
|
||||
|
||||
@@ -29,16 +29,16 @@ def try_iter_content(types, depth=0):
|
||||
|
||||
|
||||
class AbstractArguments():
|
||||
def eval_argument_clinic(self, arguments):
|
||||
def eval_argument_clinic(self, parameters):
|
||||
"""Uses a list with argument clinic information (see PEP 436)."""
|
||||
iterator = self.unpack()
|
||||
for i, (name, optional, allow_kwargs) in enumerate(arguments):
|
||||
for i, (name, optional, allow_kwargs) in enumerate(parameters):
|
||||
key, argument = next(iterator, (None, None))
|
||||
if key is not None:
|
||||
raise NotImplementedError
|
||||
if argument is None and not optional:
|
||||
debug.warning('TypeError: %s expected at least %s arguments, got %s',
|
||||
name, len(arguments), i)
|
||||
name, len(parameters), i)
|
||||
raise ValueError
|
||||
values = set() if argument is None else argument.infer()
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
||||
return ContextName(self, self._class_context.name.string_name)
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s of %s(%s)>" % (self.__type__.__name__, self._class_context,
|
||||
return "<%s of %s(%s)>" % (self.__class__.__name__, self._class_context,
|
||||
self.var_args)
|
||||
|
||||
|
||||
@@ -388,7 +388,7 @@ class InstanceElement(use_metaclass(CachedMetaClass, tree.Base)):
|
||||
return FunctionContext.py__call__(self, params)
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s of %s>" % (self.__type__.__name__, self.var)
|
||||
return "<%s of %s>" % (self.__class__.__name__, self.var)
|
||||
|
||||
|
||||
class Wrapper(tree.Base):
|
||||
@@ -507,7 +507,7 @@ class ClassContext(use_metaclass(CachedMetaClass, context.TreeContext, Wrapper))
|
||||
raise KeyError("Couldn't find subscope.")
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s of %s>" % (self.__type__.__name__, self.classdef)
|
||||
return "<%s of %s>" % (self.__class__.__name__, self.classdef)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
@@ -568,7 +568,7 @@ class FunctionContext(use_metaclass(CachedMetaClass, context.TreeContext, Wrappe
|
||||
return compiled.get_special_object(self.evaluator, name)
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s of %s>" % (self.__type__.__name__, self.base_func)
|
||||
return "<%s of %s>" % (self.__class__.__name__, self.base_func)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
||||
Reference in New Issue
Block a user