Skip to content

Update black to 21.12b0 #2366

@vfdev-5

Description

@vfdev-5

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions