Skip to content

--future moves specified namespace before __future__ #1463

@tobiasherp

Description

@tobiasherp

I like to have compatibility packages like six right below the __future__ imports; therefore I tried --future six to isort the following little example:

 from __future__ import print_function
 
 import six
 from AccessControl import Unauthorized
 from six.moves.urllib.parse import urlsplit, urlunsplit
 
 print('done!')

However, because of the --future option, the six imports are put above the __future__ imports, like so:

import six
from six.moves.urllib.parse import urlsplit, urlunsplit

from __future__ import print_function
from AccessControl import Unauthorized


print('done!')

This won't compile, of course.
Nothing is allowed above __future__ imports but comments and the module docstring (and empty lines, and other __future__ imports).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions