You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the --float-to-top is achieved by this upfront parse and sort that rearranges the input lines and floats up the imports to the top.
However this works only if there are any imports at the top to start with.
I think that when config.float_to_top is True, import_index returned by parse could be modified to return an index at the top of the file.
However, the top of the file probably shouldn't be 0, we should skip over any docstrings and comments?
From PEP8:
Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants.
Consider the following snippet:
If you run
isort --float-to-top
nothing is changed. If you insertimport b
above the definition offoo
, the same command correctly results inThe text was updated successfully, but these errors were encountered: