remove magic comma in some places#5880
Merged
pmeier merged 2 commits intopytorch:mainfrom Apr 26, 2022
Merged
Conversation
NicolasHug
approved these changes
Apr 26, 2022
|
Hey @pmeier! You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py |
facebook-github-bot
pushed a commit
that referenced
this pull request
May 6, 2022
Reviewed By: jdsgomes, NicolasHug Differential Revision: D36095662 fbshipit-source-id: aa1d3fb99f743c0a7108011581b8db6da9d3d3b8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

I discovered these while working on #5879.
By default
blacktreats a trailing comma in a sequence as "magic" and explodes it regardless of the number of items in it. This is usually useful if you want to communicate that a sequence might grow in the future and you than only need to add a new line rather than reformatting the sequence.However, sometimes the original author did not intend this and in turn
blackturns legible code into a mess. This PR fixes two instances where the new format is especially bad. In general, we can detect all such cases by runningblack -Cand looking at the differences. There are 105 files in thetorchvisionpackage that will be formatted. I haven't looked at the diffs to see how bad the situation is.