1212
1313
1414class FunctionTransformer :
15- def __init__ (self , function : Callable , decorator_lineno : int , decorator_name : str , extra_transformers : Optional [ List [ NodeTransformer ]] = None ) -> None :
15+ def __init__ (self , function : Callable , decorator_lineno : int , decorator_name : str ) -> None :
1616 if isinstance (function , type (self )):
1717 raise DualUseOfDecoratorError (f"You cannot use the '{ decorator_name } ' decorator twice for the same function." )
1818 if not isfunction (function ):
@@ -25,7 +25,6 @@ def __init__(self, function: Callable, decorator_lineno: int, decorator_name: st
2525 self .function = function
2626 self .decorator_lineno = decorator_lineno
2727 self .decorator_name = decorator_name
28- self .extra_transformers = extra_transformers
2928 self .base_object = None
3029 self .cache : Dict [str , Callable ] = {}
3130
@@ -42,8 +41,8 @@ def is_lambda(function: Callable) -> bool:
4241 lambda_example = lambda : 0 # noqa: E731
4342 return isinstance (function , type (lambda_example )) and function .__name__ == lambda_example .__name__
4443
45- def get_usual_function (self ):
46- return self .extract_context ('sync_context' )
44+ def get_usual_function (self , addictional_transformers : Optional [ List [ NodeTransformer ]] = None ):
45+ return self .extract_context ('sync_context' , addictional_transformers = addictional_transformers )
4746
4847 def get_async_function (self ):
4948 original_function = self .function
@@ -106,12 +105,6 @@ def extract_context(self, context_name: str, addictional_transformers: Optional[
106105 except OSError :
107106 source_code = dill_getsource (self .function )
108107
109- if addictional_transformers is None :
110- addictional_transformers = self .extra_transformers
111- else :
112- if self .extra_transformers is not None :
113- addictional_transformers = addictional_transformers + self .extra_transformers
114-
115108 converted_source_code = self .clear_spaces_from_source_code (source_code )
116109 tree = parse (converted_source_code )
117110 original_function = self .function
0 commit comments