We are experiencing an issue where the __all__ declaration gets positioned between runtime and type checking imports. E.g.,
So I've slapped this together as a PoC.
The PR updates visitor so that the last_import is updated for import lines that occur within an if TYPE_CHECKING block.
I've not done any ast stuff before, so don't really know if what I've added here is a good way to go about it, also how far I should go with tests. Any advice appreciated.
We are experiencing an issue where the
__all__
declaration gets positioned between runtime and type checking imports. E.g.,So I've slapped this together as a PoC.
The PR updates visitor so that the
last_import
is updated for import lines that occur within anif TYPE_CHECKING
block.I've not done any ast stuff before, so don't really know if what I've added here is a good way to go about it, also how far I should go with tests. Any advice appreciated.