File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -2123,14 +2123,17 @@ def visit_arguments(self, node: ast.arguments) -> None:
21232123 self .visit (node .kwarg )
21242124
21252125 def _check_pseudo_protocol (self , node : ast .expr | None ) -> None :
2126+ if node is None :
2127+ return
21262128 if isinstance (node , ast .Subscript ):
21272129 self ._check_pseudo_protocol (node .value )
21282130 self ._check_pseudo_protocol (node .slice )
21292131 if _is_pep_604_union (node ):
21302132 self ._check_pseudo_protocol (node .left )
21312133 self ._check_pseudo_protocol (node .right )
2132- if isinstance (node , ast .Name ) and node .id in PSEUDO_PROTOCOLS :
2133- self .error (node , errors .Y092 .format (arg = node .id ))
2134+ for name in PSEUDO_PROTOCOLS :
2135+ if _is_object (node , name , from_ = _TYPING_OR_COLLECTIONS_ABC ):
2136+ self .error (node , errors .Y092 .format (arg = name ))
21342137
21352138 def check_arg_default (self , arg : ast .arg , default : ast .expr | None ) -> None :
21362139 self .visit (arg )
You can’t perform that action at this time.
0 commit comments