@@ -7542,25 +7542,25 @@ def has_valid_attribute(self, typ: Type, name: str) -> bool:
75427542 def get_expression_type (self , node : Expression , type_context : Type | None = None ) -> Type :
75437543 return self .expr_checker .accept (node , type_context = type_context )
75447544
7545- def check_deprecated (self , typ : SymbolNode | None , context : Context ) -> None :
7545+ def check_deprecated (self , node : SymbolNode | None , context : Context ) -> None :
75467546 """Warn if deprecated and not directly imported with a `from` statement."""
7547- if isinstance (typ , Decorator ):
7548- typ = typ .func
7549- if isinstance (typ , (FuncDef , OverloadedFuncDef , TypeInfo )) and (
7550- typ .deprecated is not None
7547+ if isinstance (node , Decorator ):
7548+ node = node .func
7549+ if isinstance (node , (FuncDef , OverloadedFuncDef , TypeInfo )) and (
7550+ node .deprecated is not None
75517551 ):
75527552 for imp in self .tree .imports :
7553- if isinstance (imp , ImportFrom ) and any (typ .name == n [0 ] for n in imp .names ):
7553+ if isinstance (imp , ImportFrom ) and any (node .name == n [0 ] for n in imp .names ):
75547554 break
75557555 else :
7556- self .warn_deprecated (typ , context )
7556+ self .warn_deprecated (node , context )
75577557
7558- def warn_deprecated (self , typ : SymbolNode | None , context : Context ) -> None :
7558+ def warn_deprecated (self , node : SymbolNode | None , context : Context ) -> None :
75597559 """Warn if deprecated."""
7560- if isinstance (typ , Decorator ):
7561- typ = typ .func
7562- if isinstance (typ , (FuncDef , OverloadedFuncDef , TypeInfo )) and (
7563- (deprecated := typ .deprecated ) is not None
7560+ if isinstance (node , Decorator ):
7561+ node = node .func
7562+ if isinstance (node , (FuncDef , OverloadedFuncDef , TypeInfo )) and (
7563+ (deprecated := node .deprecated ) is not None
75647564 ):
75657565 warn = self .msg .fail if self .options .report_deprecated_as_error else self .msg .note
75667566 warn (deprecated , context , code = codes .DEPRECATED )
0 commit comments