I have been explicitly warned that the next release of flake8 is likely to break flake8-pyi, due to the amount of monkeypatching we do in this plugin, and a refactoring of flake8 internals that's currently underway. We should probably do something about that.
Ideally, I think we'd file PRs to flake8 and pyflakes so that they become pyi-compatible out of the box, rendering some of the crazy hacks in our code base unnecessary. I'm not really sure where to start, though.