Revert some of the Decoratee changes

This commit is contained in:
Dave Halter
2020-06-27 02:17:53 +02:00
parent 804b0f0d06
commit 4188526e2d
2 changed files with 1 additions and 27 deletions

View File

@@ -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

View File

@@ -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):