`HANGING_INDENT` Multi Line Import adds comma in profile hug
I have imports like so:
from vr_backend.shims.tensorboard_shim.tensorboard_writer import \
TensorBoardWriter
I run isort on that file like so:
venv/bin/python -m isort --profile hug --line-length=79 -m HANGING_INDENT main.py
I get superfluous commas in the imports:
from vr_backend.shims.tensorboard_shim.tensorboard_writer import \
TensorBoardWriter,
This is not valid Python syntax and thus even causes errors when trying to execute the file:
File "/home/bengt/Downloads/DFKI/gitlab.ni.dfki.de/VR/VR.Backend/vr_backend/vae/main.py", line 14
TensorBoardWriter,
^
SyntaxError: trailing comma not allowed without surrounding parentheses
My current workaround is to manually not check in these faulty lines. This is however cumbersome and error-prone.
On a ~ 1.3k line code base, I get this error 33 times, so it is quite widespread for me.
According to the documentation, there should be no trailing comma in the last line of a hanging-indent multi line import:
from third_party import \
lib1, lib2, lib3, \
lib4, lib5, lib6
Source: https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html#2-hanging-indent
So, I would have expected my imports to remain unchanged like so:
from vr_backend.shims.tensorboard_shim.tensorboard_writer import \
TensorBoardWriter
Not using --profile hug seems to avoid the problem as well.
Basically this config results in this behaviour:
include_trailing_comma = true
multi_line_output = 2