mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 05:54:25 +08:00
Revert some of the Decoratee changes
This commit is contained in:
@@ -4,8 +4,6 @@ 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):
|
||||
@@ -21,27 +19,3 @@ class Decoratee(ValueWrapper):
|
||||
Decoratee(v, self._original_value)
|
||||
for v in self._wrapped_value.py__get__(instance, class_value)
|
||||
)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
if self._wrapped_value.is_function():
|
||||
# If a function is returned, the name that we want is usually the
|
||||
# original one. This is obviously a bit weird, but it works pretty
|
||||
# well, since users don't pass around functions randomly.
|
||||
val = self._original_value
|
||||
else:
|
||||
val = self._wrapped_value
|
||||
|
||||
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(f)\n\nNice docstring'
|
||||
assert d.docstring() == 'wrapper(f)\n\nNice docstring'
|
||||
|
||||
|
||||
def test_partial(Script):
|
||||
|
||||
Reference in New Issue
Block a user