mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
Remove evaluator as param from apply_decorators.
This commit is contained in:
@@ -6,6 +6,7 @@ import operator as op
|
|||||||
|
|
||||||
from parso.python import tree
|
from parso.python import tree
|
||||||
|
|
||||||
|
from jedi._compatibility import unicode
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import parser_utils
|
from jedi import parser_utils
|
||||||
from jedi.evaluate.context import ContextSet, NO_CONTEXTS, ContextualizedNode, \
|
from jedi.evaluate.context import ContextSet, NO_CONTEXTS, ContextualizedNode, \
|
||||||
@@ -488,7 +489,7 @@ def tree_name_to_contexts(evaluator, context, tree_name):
|
|||||||
from jedi.evaluate import imports
|
from jedi.evaluate import imports
|
||||||
types = imports.infer_import(context, tree_name)
|
types = imports.infer_import(context, tree_name)
|
||||||
elif typ in ('funcdef', 'classdef'):
|
elif typ in ('funcdef', 'classdef'):
|
||||||
types = _apply_decorators(evaluator, context, node)
|
types = _apply_decorators(context, node)
|
||||||
elif typ == 'try_stmt':
|
elif typ == 'try_stmt':
|
||||||
# TODO an exception can also be a tuple. Check for those.
|
# TODO an exception can also be a tuple. Check for those.
|
||||||
# TODO check for types that are not classes and add it to
|
# TODO check for types that are not classes and add it to
|
||||||
@@ -500,7 +501,7 @@ def tree_name_to_contexts(evaluator, context, tree_name):
|
|||||||
return types
|
return types
|
||||||
|
|
||||||
|
|
||||||
def _apply_decorators(evaluator, context, node):
|
def _apply_decorators(context, node):
|
||||||
"""
|
"""
|
||||||
Returns the function, that should to be executed in the end.
|
Returns the function, that should to be executed in the end.
|
||||||
This is also the places where the decorators are processed.
|
This is also the places where the decorators are processed.
|
||||||
@@ -508,13 +509,13 @@ def _apply_decorators(evaluator, context, node):
|
|||||||
from jedi.evaluate import representation as er
|
from jedi.evaluate import representation as er
|
||||||
if node.type == 'classdef':
|
if node.type == 'classdef':
|
||||||
decoratee_context = er.ClassContext(
|
decoratee_context = er.ClassContext(
|
||||||
evaluator,
|
context.evaluator,
|
||||||
parent_context=context,
|
parent_context=context,
|
||||||
classdef=node
|
classdef=node
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
decoratee_context = er.FunctionContext(
|
decoratee_context = er.FunctionContext(
|
||||||
evaluator,
|
context.evaluator,
|
||||||
parent_context=context,
|
parent_context=context,
|
||||||
funcdef=node
|
funcdef=node
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user