forked from VimPlug/jedi
Fix call signatures.
This commit is contained in:
@@ -121,7 +121,7 @@ class CompiledObject(Context):
|
||||
parts = p.strip().split('=')
|
||||
if len(parts) > 1:
|
||||
parts.insert(1, Operator('=', (0, 0)))
|
||||
yield UnresolvableParamName(self, p[0])
|
||||
yield UnresolvableParamName(self, parts[0])
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s: %s>' % (self.__class__.__name__, repr(self.obj))
|
||||
@@ -373,8 +373,11 @@ class CompiledObjectFilter(AbstractFilter):
|
||||
@memoize_method
|
||||
def get(self, name):
|
||||
name = str(name)
|
||||
obj = self._compiled_obj.obj
|
||||
try:
|
||||
getattr(self._compiled_obj.obj, name)
|
||||
getattr(obj, name)
|
||||
if self._is_instance and name not in dir(obj):
|
||||
return []
|
||||
except AttributeError:
|
||||
return []
|
||||
except Exception:
|
||||
|
||||
@@ -69,7 +69,8 @@ class TreeNameDefinition(ContextName):
|
||||
def api_type(self):
|
||||
definition = self.tree_name.get_definition()
|
||||
return dict(
|
||||
import_name='import',
|
||||
import_name='module',
|
||||
import_from='module',
|
||||
funcdef='function',
|
||||
param='param',
|
||||
classdef='class',
|
||||
|
||||
@@ -224,7 +224,10 @@ class CompiledInstanceName(compiled.CompiledName):
|
||||
parent_context, result_context.funcdef
|
||||
)
|
||||
else:
|
||||
yield result_context
|
||||
if result_context.api_type == 'function':
|
||||
yield CompiledBoundMethod(result_context)
|
||||
else:
|
||||
yield result_context
|
||||
|
||||
|
||||
class CompiledInstanceClassFilter(compiled.CompiledObjectFilter):
|
||||
@@ -257,6 +260,15 @@ class BoundMethod(er.FunctionContext):
|
||||
)
|
||||
|
||||
|
||||
class CompiledBoundMethod(compiled.CompiledObject):
|
||||
def __init__(self, func):
|
||||
super(CompiledBoundMethod, self).__init__(
|
||||
func.evaluator, func.obj, func.parent_context, func.classdef)
|
||||
|
||||
def get_param_names(self):
|
||||
return list(super(CompiledBoundMethod, self).get_param_names())[1:]
|
||||
|
||||
|
||||
class InstanceNameDefinition(filters.TreeNameDefinition):
|
||||
def infer(self):
|
||||
contexts = super(InstanceNameDefinition, self).infer()
|
||||
|
||||
Reference in New Issue
Block a user