Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update black to 21.12b0 #2366

Closed
11 tasks done
vfdev-5 opened this issue Dec 18, 2021 · 0 comments · Fixed by #2372 or #2378
Closed
11 tasks done

Update black to 21.12b0 #2366

vfdev-5 opened this issue Dec 18, 2021 · 0 comments · Fixed by #2372 or #2378

Comments

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Dec 18, 2021

The idea is to update black version and minimally reformat the codebase.

If we blindly reformat the codebase with newer black it will modify 105 files

All done! ✨ 🍰 ✨
105 files reformatted, 181 files left unchanged.

Most of modifications are related to handling trailing commas in the lists:
Today we have with old black:

a = [123, 345, ]

and new black make it as

a = [
    123,
    345,
]

However, if we remove the last , with the new black it will become again as

a = [123, 345]

I'll create specific branch to this update (https://github.com/pytorch/ignite/tree/black-21.12b0) and the goal is to go through the updated codebase and make modifications as small as possible in terms of number of lines: basically remove trailing comma and rerun black.

  • ignite folder
    • engine
    • metrics
    • handlers
    • distributed
  • tests folder
    • engine
    • metrics
    • handlers
    • distributed
  • other folders

If someone would like to help with this issue, please submit the PRs to black-21.12b0 branch and not master.

How to work on this issue, for example, update tests/ignite/handers folder:

git checkout -b black-21.12b0
bash tests/run_code_style.sh install
black tests/ignite/handers
# ... list of modified files
git status
# ... list of modified files

next, open each modified file, find the modification and check if the number of added lines can be reduced by removing the trailing comma (as explained above). Update the file and rerun black:

black tests/ignite/handers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant