zimports 0.2.1 crashes with an IndexError when trying to read an empty file. This is a regression from 0.2.0:
ralf@triton ~/t % touch __init__.py
ralf@triton ~/t % zimports __init__.py
Traceback (most recent call last):
File "/home/ralf/.local/bin/zimports", line 8, in <module>
sys.exit(main())
File "/home/ralf/.local/pipx/venvs/zimports/lib64/python3.8/site-packages/zimports.py", line 766, in main
_run_file(options, filename)
File "/home/ralf/.local/pipx/venvs/zimports/lib64/python3.8/site-packages/zimports.py", line 622, in _run_file
lines, encoding_comment = _read_python_source(filename)
File "/home/ralf/.local/pipx/venvs/zimports/lib64/python3.8/site-packages/zimports.py", line 560, in _read_python_source
if text[-1] == "\n":
IndexError: string index out of range
zimports 0.2.1 crashes with an IndexError when trying to read an empty file. This is a regression from 0.2.0: