-k, --keep-direct-and-as
Turns off default behavior that removes direct imports
when as imports exist.
But when I have file test.py:
from django.utils.translation import ugettext as _, ugettext
and run isort -k test.py or isort --keep-direct-and-as test.py, the result is:
from django.utils.translation import ugettext as _
isort version is 4.3.4.
I'm gonna piggyback on this issue. It seems to me that it hasn't been resolved completely. What I mean by completely is that if the "duplicate" imports are at the same line then isort will not change it and hence not break the code. However if the imports are split so that each import has it's own line e.g.
from django.utils.translation import ugettext as _
from django.utils.translation import ugettext
then when we run isort --keep-direct-and-as ./path_to_file/ will give us these results
from django.utils.translation import ugettext as _
which obviously will break the code.
isort version is 4.3.21
This is fixed in develop and will make it's way out in the 5.0.0 release.
Thanks!
~Timothy
Most helpful comment
This is fixed in develop and will make it's way out in the 5.0.0 release.
Thanks!
~Timothy