brettcannon / caniusepython3

Can I Use Python 3?
Apache License 2.0
412 stars 60 forks source link

`unicode_literals` import isn't detected if part of a multiline import statement #207

Open wyattanderson opened 5 years ago

wyattanderson commented 5 years ago

Thanks for this helpful tool! We're excited to incorporate it into our workflow. I found one very slightly inconvenient bug when futurizing a particular file added the following from __future__ imports:

from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals

Subsequently running isort reduces this to:

from __future__ import (absolute_import, division, print_function,
                        unicode_literals)

Now, errors about native string literals appear where they otherwise would not, assumedly because this check only checks for the presence of unicode_literals on the same line only.

Happy to take a whack at a PR.

brettcannon commented 5 years ago

A PR would be appreciated!