Here is a stack trace produced by pre-commit hook.
ERROR: Unrecoverable exception thrown when parsing dataset/__init__.py! This should NEVER happen.
If encountered, please open an issue: https://github.com/PyCQA/isort/issues/new
Traceback (most recent call last):
File "/home/username/.cache/pre-commit/repo5m26nnl8/py_env-python3.12/bin/isort", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/username/.cache/pre-commit/repo5m26nnl8/py_env-python3.12/lib/python3.12/site-packages/isort/main.py", line 1228, in main
for sort_attempt in attempt_iterator:
^^^^^^^^^^^^^^^^
File "/home/username/.cache/pre-commit/repo5m26nnl8/py_env-python3.12/lib/python3.12/site-packages/isort/main.py", line 1212, in <genexpr>
sort_imports( # type: ignore
File "/home/username/.cache/pre-commit/repo5m26nnl8/py_env-python3.12/lib/python3.12/site-packages/isort/main.py", line 87, in sort_imports
incorrectly_sorted = not api.check_file(file_name, config=config, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/username/.cache/pre-commit/repo5m26nnl8/py_env-python3.12/lib/python3.12/site-packages/isort/api.py", line 338, in check_file
return check_stream(
^^^^^^^^^^^^^
File "/home/username/.cache/pre-commit/repo5m26nnl8/py_env-python3.12/lib/python3.12/site-packages/isort/api.py", line 264, in check_stream
changed: bool = sort_stream(
^^^^^^^^^^^^
File "/home/username/.cache/pre-commit/repo5m26nnl8/py_env-python3.12/lib/python3.12/site-packages/isort/api.py", line 210, in sort_stream
changed = core.process(
^^^^^^^^^^^^^
File "/home/username/.cache/pre-commit/repo5m26nnl8/py_env-python3.12/lib/python3.12/site-packages/isort/core.py", line 153, in process
sort_section_pointer += output_stream.write(sorted_code)
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'
Here is a source file which causes the issue.
Here is a
pre-commit
configuration file (if one omitsargs
then everything is fine).Here is a stack trace produced by pre-commit hook.