forked from VimPlug/jedi
Fix signatures if a decorator has no signatures, fixes #1705
This commit is contained in:
@@ -19,3 +19,11 @@ class Decoratee(ValueWrapper):
|
|||||||
Decoratee(v, self._original_value)
|
Decoratee(v, self._original_value)
|
||||||
for v in self._wrapped_value.py__get__(instance, class_value)
|
for v in self._wrapped_value.py__get__(instance, class_value)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def get_signatures(self):
|
||||||
|
signatures = self._wrapped_value.get_signatures()
|
||||||
|
if signatures:
|
||||||
|
return signatures
|
||||||
|
# Fallback to signatures of the original function/class if the
|
||||||
|
# decorator has no signature or it is not inferrable.
|
||||||
|
return self._original_value.get_signatures()
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ class X:
|
|||||||
(partialmethod_code + 'X().d(', None),
|
(partialmethod_code + 'X().d(', None),
|
||||||
(partialmethod_code + 'X.c(', 'func(a, b)'),
|
(partialmethod_code + 'X.c(', 'func(a, b)'),
|
||||||
(partialmethod_code + 'X.d(', None),
|
(partialmethod_code + 'X.d(', None),
|
||||||
|
|
||||||
|
('import contextlib\n@contextlib.contextmanager\ndef f(x): pass\nf(', 'f(x)'),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def test_tree_signature(Script, environment, code, expected):
|
def test_tree_signature(Script, environment, code, expected):
|
||||||
|
|||||||
Reference in New Issue
Block a user