[BUG] inlined with ':' for linters and type checkers
cheginit opened this issue · comments
Describe the bug A clear and concise description of what the bug is.
pycln
throws an UnsupportedCase if there's any :
in the import statement. But there
are cases where we want to provide a comment to a linters or type checkers, like so:
import numpy # type: ignore
.
To Reproduce Steps to reproduce the behavior:
-
Take this code snippet:
try: import numpy # type: ignore except ImportError: numpy = None
-
Run this Pycln command:
$ pycln
-
Error traceback or unexpected output (if present):
UnsupportedCase: an import statement inlined with ':'. ⛔
-
Unexpected fixed code (if present):
Expected behavior:
-
Description: A clear and concise description of what you expected to happen.
It would be helpful if using colon for after#
is allowed. -
Expected output (if present):
-
Expected fixed code (if present):
Environment (please complete the following information):
- Python Version: Any
- Pycln Version: v2.1.2
- OS Type: macOS
Additional context Add any other context about the problem here.
encountered the same, workaround with # nopycln: import
. (https://hadialqattan.github.io/pycln/#/?id=pycln-skips)
That's great! Appreciate it.