mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Some more signature adjustments
This commit is contained in:
@@ -90,10 +90,12 @@ class TreeSignature(AbstractSignature):
|
||||
|
||||
@memoize_method
|
||||
def get_param_names(self, resolve_stars=False):
|
||||
params = super(TreeSignature, self).get_param_names(resolve_stars=False)
|
||||
params = self._function_value.get_param_names()
|
||||
if resolve_stars:
|
||||
from jedi.inference.star_args import process_params
|
||||
params = process_params(params)
|
||||
if self.is_bound:
|
||||
return params[1:]
|
||||
return params
|
||||
|
||||
def matches_signature(self, arguments):
|
||||
|
||||
@@ -5,6 +5,7 @@ docstrings and other things around decorators.
|
||||
|
||||
from jedi.inference.base_value import ValueWrapper, ValueSet
|
||||
from jedi.inference.names import ValueName
|
||||
from jedi.inference.signature import SignatureWrapper
|
||||
|
||||
|
||||
class Decoratee(ValueWrapper):
|
||||
@@ -34,3 +35,13 @@ class Decoratee(ValueWrapper):
|
||||
if val.name.tree_name is not None:
|
||||
return ValueName(self, val.name.tree_name)
|
||||
return self._wrapped_value.name
|
||||
|
||||
def get_signatures(self):
|
||||
return [DecorateeSignature(sig, self.name)
|
||||
for sig in self._wrapped_value.get_signatures()]
|
||||
|
||||
|
||||
class DecorateeSignature(SignatureWrapper):
|
||||
def __init__(self, signature, name):
|
||||
super(DecorateeSignature, self).__init__(signature)
|
||||
self.name = name
|
||||
|
||||
@@ -440,7 +440,7 @@ def test_method_decorator(Script):
|
||||
Foo().check_user''')
|
||||
|
||||
d, = Script(code).infer()
|
||||
assert d.docstring() == 'check_user(self, f)\n\nNice docstring'
|
||||
assert d.docstring() == 'check_user(f)\n\nNice docstring'
|
||||
|
||||
|
||||
def test_partial(Script):
|
||||
|
||||
Reference in New Issue
Block a user