I have the following import:
from PyPDF2.constants import (
CatalogAttributes as CA,
Core as CO,
DocumentInformationAttributes as DI,
EncryptionDictAttributes as ED,
PageAttributes as PG,
PagesAttributes as PA,
StreamAttributes as SA,
TrailerKeys as TK,
CatalogDictionary as CD,
)
I want to use isort and I want to keep the vertical hanging indent. It works fine for all other imports, but this one just always gets converted to:
from PyPDF2.constants import CatalogAttributes as CA
from PyPDF2.constants import CatalogDictionary as CD
from PyPDF2.constants import Core as CO
from PyPDF2.constants import DocumentInformationAttributes as DI
from PyPDF2.constants import EncryptionDictAttributes as ED
from PyPDF2.constants import PageAttributes as PG
from PyPDF2.constants import PagesAttributes as PA
from PyPDF2.constants import StreamAttributes as SA
from PyPDF2.constants import TrailerKeys as TK
How can I make isort keep / enforce this grouping by the module from which it was imported? Why is it even doing that with my given configuration?
This is my .isort.cfg
:
[settings]
line_length=79
indent=' '
multi_line_output=3
length_sort=0
include_trailing_comma=True
It seems that there is an option that you need:
As a flag:
My .toml config looks like:
And the result of isort applied for your code is: