mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Fix some minor signature issues
This commit is contained in:
@@ -232,8 +232,8 @@ class AbstractInstanceContext(Context):
|
||||
return class_context
|
||||
|
||||
def get_signatures(self):
|
||||
init_funcs = self.py__getattribute__('__call__')
|
||||
return [sig.bind(self) for sig in init_funcs.get_signatures()]
|
||||
call_funcs = self.py__getattribute__('__call__').py__get__(self, self.class_context)
|
||||
return [s.bind(self) for s in call_funcs.get_signatures()]
|
||||
|
||||
def __repr__(self):
|
||||
return "<%s of %s(%s)>" % (self.__class__.__name__, self.class_context,
|
||||
@@ -400,7 +400,7 @@ class BoundMethod(FunctionMixin, ContextWrapper):
|
||||
return function_execution.infer()
|
||||
|
||||
def get_signatures(self):
|
||||
return [sig.bind(self) for sig in super(BoundMethod, self).get_signatures()]
|
||||
return [sig.bind(self, self) for sig in self._wrapped_context.get_signatures()]
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s: %s>' % (self.__class__.__name__, self._wrapped_context)
|
||||
|
||||
@@ -50,17 +50,20 @@ class AbstractSignature(_SignatureMixin):
|
||||
return param_names[1:]
|
||||
return param_names
|
||||
|
||||
def bind(self, context):
|
||||
def bind(self, context, function_context=None):
|
||||
raise NotImplementedError
|
||||
|
||||
def __repr__(self):
|
||||
return '<%s: %s, %s>' % (self.__class__.__name__, self.context, self._function_context)
|
||||
|
||||
|
||||
class TreeSignature(AbstractSignature):
|
||||
def __init__(self, context, function_context=None, is_bound=False):
|
||||
super(TreeSignature, self).__init__(context, is_bound)
|
||||
self._function_context = function_context or context
|
||||
|
||||
def bind(self, context):
|
||||
return TreeSignature(context, self._function_context, is_bound=True)
|
||||
def bind(self, context, function_context=None):
|
||||
return TreeSignature(context, function_context or self._function_context, is_bound=True)
|
||||
|
||||
@property
|
||||
def _annotation(self):
|
||||
@@ -98,7 +101,7 @@ class BuiltinSignature(AbstractSignature):
|
||||
def _function_context(self):
|
||||
return self.context
|
||||
|
||||
def bind(self, context):
|
||||
def bind(self, context, function_context=None):
|
||||
assert not self.is_bound
|
||||
return BuiltinSignature(context, self._return_string, is_bound=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user