@@ -175,7 +175,7 @@ def extract_context(self, context_name: str, addictional_transformers: Optional[
175175 converted_source_code = self .clear_spaces_from_source_code (source_code )
176176 tree = parse (converted_source_code )
177177 original_function = self .function
178- transfunction_decorator = None
178+ transfunction_decorator : Optional [ Name ] = None
179179 decorator_name = self .decorator_name
180180
181181 class RewriteContexts (NodeTransformer ):
@@ -213,7 +213,7 @@ def visit_FunctionDef(self, node: FunctionDef) -> Optional[Union[AST, List[AST]]
213213 else :
214214 if transfunction_decorator is not None :
215215 raise DualUseOfDecoratorError (f"You cannot use the @{ decorator_name } decorator twice for the same function." )
216- transfunction_decorator = decorator
216+ transfunction_decorator = cast ( Name , decorator )
217217
218218 node .decorator_list = []
219219 return node
@@ -236,9 +236,9 @@ def visit_FunctionDef(self, node: FunctionDef) -> Optional[Union[AST, List[AST]]
236236 tree = self .wrap_ast_by_closures (tree )
237237
238238 if version_info .minor > 10 :
239- increment_lineno (tree , n = (self .decorator_lineno - transfunction_decorator .lineno ))
239+ increment_lineno (tree , n = (self .decorator_lineno - cast ( Name , transfunction_decorator ) .lineno ))
240240 else :
241- increment_lineno (tree , n = (self .decorator_lineno - transfunction_decorator .lineno - 1 ))
241+ increment_lineno (tree , n = (self .decorator_lineno - cast ( Name , transfunction_decorator ) .lineno - 1 ))
242242
243243 code = compile (tree , filename = getfile (self .function ), mode = 'exec' )
244244 namespace = UniversalNamespaceAroundFunction (self .function , self .frame )
0 commit comments