core icon indicating copy to clipboard operation
core copied to clipboard

Fix code related to import statements with isort

Open stweil opened this issue 1 year ago • 3 comments

The fix was done in a virtual Python environment:

pip install isort
isort .

It orders the import statements and fixes their formatting.

stweil avatar Jan 28 '24 08:01 stweil

I think the Python code should follow the PEP 8 style guide.

This pull request supports the intoduction of coding guidelines for the OCR-D code where using isort should be part of. The same kind of fixes will be necessary for all Python based OCR-D processors as well.

Using flake8 would be a next step. That tool currently reports 14257 issues for core, so the required changes are huge.

stweil avatar Jan 28 '24 08:01 stweil

Tools which can help getting cleaner Python code: https://github.com/life4/awesome-python-code-formatters.

stweil avatar Jan 28 '24 09:01 stweil

https://github.com/OCR-D/format-converters/pull/25 shows how PEP 8 style issues can be fixed.

stweil avatar Jan 28 '24 09:01 stweil