LLNL / scr

SCR caches checkpoint data in storage on the compute nodes of a Linux cluster to provide a fast, scalable checkpoint / restart capability for MPI codes.
http://computing.llnl.gov/projects/scalable-checkpoint-restart-for-mpi
Other
99 stars 36 forks source link

python: run docformatter #557

Closed adammoody closed 1 year ago

adammoody commented 1 year ago

The yapf formatter indents docstrings with 2 spaces, which is a bit ugly. After searching for a config change via yapf, I came across this issue:

https://github.com/google/yapf/issues/60

which points to docformatter:

https://pypi.org/project/docformatter/

So we can run yapf to do most formatting, then follow that with docformatter to clean up the docstrings.

Here are the updated set of commands:

python3 -m venv --system-site-packages env
source env/bin/activate

pip install --upgrade pip
pip install yapf
pip install --upgrade docformatter

yapf -i python/*.py python/*.py.in
yapf -i scripts/python/setup.py
find scripts/python/scrjob -regex '.*\.py' -print | xargs yapf -i
find scripts/python/scrjob -regex '.*\.py\.in' -print | xargs yapf -i
find scripts/python/tests -regex '.*\.py' -print | xargs yapf -i

docformatter --in-place python/*.py python/*.py.in
docformatter --in-place scripts/python/setup.py
find scripts/python/scrjob -regex '.*\.py' -print | xargs docformatter --in-place
find scripts/python/scrjob -regex '.*\.py\.in' -print | xargs docformatter --in-place
find scripts/python/tests -regex '.*\.py' -print | xargs docformatter --in-place