Commit 97d9b65
committed
Apply intended suppression in Tree.traverse
The superclass _traverse method call in Tree.traverse appears to
have once had a working suppression for the incompatbile types of
two arguments, `predicate` and `prune`, as well as for an argument
that required (and requires) no suppression, `depth`. These three
arguments were written on the same line, which bad a `type: ignore`
comment on it. But when black formatting was applied in 21ec529
(#1442), that comment moved so that it was on a line with just the
`depth` call that didn't need it, rather than the others that did.
Since then, mypy has reported errors, which further seem intended
to suppress based on the surrounding context and the use of `cast`
to deal with the static type incompatibilities going the other way.
This misplaced suppression was one of the ones I very recently
removed in 84fc806. But really there should be a suppression for
those arguments (at least for now, while the code remains written
that way, given that a suppression is intended).
This suppresses the error effectively by inserting two suppression
comments, one for each of the two arguments. This is more specific
than a single suppression applying to the whole call, and keeping
the arguments on separate lines both makes black happy and makes
clear that it is not by coincidence that the error is suppressed
for both of them. The new suppressions are also written for the
specific mypy error at issue, rather than fully general as before.
This change decreases the number of mypy errors by two.1 parent 96ecc2e commit 97d9b65
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | | - | |
333 | | - | |
| 332 | + | |
| 333 | + | |
334 | 334 | | |
335 | 335 | | |
336 | 336 | | |
| |||
0 commit comments