I just discovered the sorted literals feature, which is fantastic. One behavior I'm noticing is that if you have a literal before any imports, then isort doesn't appear to pick up on that literal.
The following example won't have __all__ sorted:
"""I'm a docstring! Look at me!"""
# isort: unique-list
__all__ = ["Foo", "Foo", "Bar"]
from typing import final # arbitrary
@final
class Foo:
...
@final
class Bar:
...
However, these two examples appear to be fine and will have __all__ sorted correctly.
# Some top-level comment before the docstring.
# Maybe it's a copyright. It's probably a copyright.
"""I'm a docstring! Look at me!"""
# isort: unique-list
__all__ = ["Foo", "Foo", "Bar"]
from typing import final # arbitrary
@final
class Foo:
...
@final
class Bar:
...
"""I'm a docstring! Look at me!"""
from __future__ import annotations
# isort: unique-list
__all__ = ["Foo", "Foo", "Bar"]
from typing import final # arbitrary
@final
class Foo:
...
@final
class Bar:
...
I just discovered the sorted literals feature, which is fantastic. One behavior I'm noticing is that if you have a literal before any imports, then
isortdoesn't appear to pick up on that literal.The following example won't have
__all__sorted:However, these two examples appear to be fine and will have
__all__sorted correctly.