mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-18 03:25:55 +08:00
Fix _BuiltinMappedMethod to use a ValueWrapper
This commit is contained in:
@@ -246,24 +246,18 @@ class MergedFilter(object):
|
|||||||
return '%s(%s)' % (self.__class__.__name__, ', '.join(str(f) for f in self._filters))
|
return '%s(%s)' % (self.__class__.__name__, ', '.join(str(f) for f in self._filters))
|
||||||
|
|
||||||
|
|
||||||
class _BuiltinMappedMethod(Value):
|
class _BuiltinMappedMethod(ValueWrapper):
|
||||||
"""``Generator.__next__`` ``dict.values`` methods and so on."""
|
"""``Generator.__next__`` ``dict.values`` methods and so on."""
|
||||||
api_type = u'function'
|
api_type = u'function'
|
||||||
|
|
||||||
def __init__(self, builtin_value, method, builtin_func):
|
def __init__(self, value, method, builtin_func):
|
||||||
super(_BuiltinMappedMethod, self).__init__(
|
super(_BuiltinMappedMethod, self).__init__(builtin_func)
|
||||||
builtin_value.inference_state,
|
self._value = value
|
||||||
parent_context=builtin_value
|
|
||||||
)
|
|
||||||
self._method = method
|
self._method = method
|
||||||
self._builtin_func = builtin_func
|
|
||||||
|
|
||||||
def py__call__(self, arguments):
|
def py__call__(self, arguments):
|
||||||
# TODO add TypeError if params are given/or not correct.
|
# TODO add TypeError if params are given/or not correct.
|
||||||
return self._method(self.parent_context)
|
return self._method(self._value)
|
||||||
|
|
||||||
def __getattr__(self, name):
|
|
||||||
return getattr(self._builtin_func, name)
|
|
||||||
|
|
||||||
|
|
||||||
class SpecialMethodFilter(DictFilter):
|
class SpecialMethodFilter(DictFilter):
|
||||||
|
|||||||
Reference in New Issue
Block a user