When the sequence of import statements is interrupted by conditional blocks, ISort thinks the imports have ended and wants the conditional block to be separated from other import statements.
Given this correctly-ordered code:
import pytz
try:
import semver
except ImportError:
# We won't be able to parse Semantic Versioning values.
semver = NotImplemented
ISort mandates these changes:
import pytz
+
+
try:
import semver
except ImportError:
# We won't be able to parse Semantic Versioning values.
semver = NotImplemented
I can't find any way to tell ISort to allow the conditional block (whether try, or if, etc.) as part of the sequence of import statements.
I also vote for this feature! =)
Ref:
+++ update_cosmosdb_document_python/update_cosmosdb_document/cli.py:after 2019-08-23 22:14:01.322106
@@ -6,7 +6,7 @@
from typing import Any
# Non-standard library python package imports
-from azure.cosmos.cosmos_client import CosmosClient # type: ignore
+from azure.cosmos.cosmos_client import CosmosClient # type: ignore
from click import (
command,
echo,
@@ -15,11 +15,6 @@
progressbar,
version_option,
)
-try:
- from IPython import embed # type: ignore
-except ImportError:
- def embed():
- pass
# Internal module package imports
This behavior has been improved in develop and should make it's way into the 5.0.0 release.
Thanks!
~Timothy
Most helpful comment
This behavior has been improved in develop and should make it's way into the 5.0.0 release.
Thanks!
~Timothy