Are there any Python scripts available that will search through a file and automatically wrap all text in a comment block? I want:
- The script to take comments lines that are too long and have them auto-wrapped to the column guide.
- The script to take comments that are wrapped to 2+ lines and try to fit them into less lines.
I don't think autopep8 does 2, please correct me if I'm wrong. I'm using PyCharm and it its auto-format option does not do 2 either.
I'm tempted to write my own script to do this because I don't think it will take long, but I wanted to check with the community first.
I couldn't find a script to do this. I wrote my own that uses textwrap. Empty comment lines are skipped and lines containing "=========" or "---------" are treated as special cases and are skipped, for example:
is skipped. The script also wraps docstrings. Here's the code, tested in Python 2.7 in Windows, use at your own risk: