# mypy: enable-error-code=redundant-exprfrom __future__ importannotationsclassNode:
parent: Node|Noneis_valid: booldeftraverse_needs_fixing(self) ->Node|None:
it: Node|Noneit=selfwhileitisnotNoneandit.is_valid: # E: Left operand of "and" is always true [redundant-expr]it=it.parentreturnitdeftraverse(self) ->Node|None:
# this only works because mypy does not narrow on initial assignment# which is something we'd like to change, see #2008it: Node|None=selfwhileitisnotNoneandit.is_valid:
it=it.parentreturnit