lint isort I001: forbid multiple imports on single line?
I tried to configure lint.isort to block multiple imports on single lines without enforcing the way multiple imports are split.
This should be reported as I001:
from typing import Any, Callable, ContextManager
Both of these variants should not be reported:
from typing import Any
from typing import Callable
from typing import ContextManager
from typing import (
Any,
Callable,
ContextManager,
)
The only setting which comes close is force-single-line=true, but then only the first variant is allowed and the last variant is reported.
This is interesting. Could you explain why you want to allow both variants?
The goal of isort is to have consistent import formatting. That's why it only allows exactly one variant.
For longer import lists the bracketed version is more readable, for a few imports the non-bracketed version is more concise without preventing nice diffs like the multiple imports on one line would.