File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -251,19 +251,10 @@ def report(
251251
252252 def span_from_context (ctx : Context ) -> Iterable [int ]:
253253 """This determines where a type: ignore for a given context has effect.
254-
255- Current logic is a bit tricky, to keep as much backwards compatibility as
256- possible. We may reconsider this to always be a single line (or otherwise
257- simplify it) when we drop Python 3.7.
258-
259- TODO: address this in follow up PR
260254 """
261- if isinstance (ctx , ( ClassDef , FuncDef ) ):
255+ if not isinstance (ctx , Expression ):
262256 return range (ctx .line , ctx .line + 1 )
263- elif not isinstance (ctx , Expression ):
264- return [ctx .line ]
265- else :
266- return range (ctx .line , (ctx .end_line or ctx .line ) + 1 )
257+ return range (ctx .line , (ctx .end_line or ctx .line ) + 1 )
267258
268259 origin_span : Iterable [int ] | None
269260 if origin is not None :
You can’t perform that action at this time.
0 commit comments