style(temporal): Sort and group imports #3959
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uses a combination of
ruff check --output-format=concise --select I --fix 'temporal/' 'python/grass/temporal'
,isort --profile=black temporal python/grass/temporal
andblack .
I separated the big
__init__.py
as I want to make sure that there aren't any side effects when importing (for python code, it shouldn't have some, but by seeing the state of some of the files, I wouldn't be surprised if there were some finally).Also, especially for the temporal framework, the big big
__init__.py
means that everything there is "shortcut-ed" to be available in the scope when importinggrass.temporal
. I'm not ready to accuse this of being the cause of temporal being slow, but during my last weekend's exploration on trying to profile some temporal tests, after fixing the big slowdown inside one loop of the ply library (that took 18% of the whole time), a big chunk of the remaining time was for importing, at least for t.rast.algebra. So cleaning up the imports and importing what is needed in the files needed (avoiding star imports) might help a little.