1
0
forked from VimPlug/jedi

Fix docstrings for wrapped functions, fixes #906

This commit is contained in:
Dave Halter
2019-07-21 12:18:51 +02:00
parent cdf50e2a69
commit 73c078ec7a
3 changed files with 41 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
'''
Decorators are not really contexts, however we need some wrappers to improve
docstrings and other things around decorators.
'''
from jedi.evaluate.base_context import ContextWrapper
class Decoratee(ContextWrapper):
def __init__(self, wrapped_context, original_context):
self._wrapped_context = wrapped_context
self._original_context = original_context
def py__doc__(self):
return self._original_context.py__doc__()
+3
View File
@@ -26,6 +26,7 @@ from jedi.evaluate.compiled.access import COMPARISON_OPERATORS
from jedi.evaluate.cache import evaluator_method_cache
from jedi.evaluate.gradual.stub_context import VersionInfo
from jedi.evaluate.gradual import annotation
from jedi.evaluate.context.decorator import Decoratee
def _limit_context_infers(func):
@@ -666,6 +667,8 @@ def _apply_decorators(context, node):
return initial
debug.dbg('decorator end %s', values, color="MAGENTA")
if values != initial:
return ContextSet([Decoratee(c, decoratee_context) for c in values])
return values