-
Notifications
You must be signed in to change notification settings - Fork 85
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
style: Update to Black v20.8 formatting #1048
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1048 +/- ##
=======================================
Coverage 96.76% 96.76%
=======================================
Files 59 59
Lines 3371 3371
Branches 478 478
=======================================
Hits 3262 3262
Misses 68 68
Partials 41 41
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
This reverts commit 535d238.
One thing might be to remove all trailing commas and see how black format handles this... |
With trailing commas removed it changes quite a bit, e.g. def extract_index_access(
baseviewer, subviewer, indices,
): (old black) becomes (with new black) def extract_index_access(
baseviewer,
subviewer,
indices,
): but when you remove the comma after indices, it becomes (still new black) def extract_index_access(baseviewer, subviewer, indices): The trailing comma forces the split across lines no matter how long the line is I believe. |
Ah this might be related to psf/black#1629 and psf/black#1649. Thanks for explaining that, @alexander-held. I'm going to put this back into Draft and think on this then. |
Yeah, @alexander-held @kratsg I think you hit it on the head here. This PR is going to need some trailing comma removal before it can go in. Thanks to both of you for solving this for me. |
@@ -9,17 +9,15 @@ def _tensorviewer_from_parmap(par_map, batch_size): | |||
names, slices, _ = list( | |||
zip( | |||
*sorted( | |||
[(k, v['slice'], v['slice'].start,) for k, v in par_map.items()], | |||
[(k, v['slice'], v['slice'].start) for k, v in par_map.items()], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the trailing comma is being removed here:
(k, v['slice'], v['slice'].start)
tb.simple_broadcast( | ||
tb.astensor([1, 1, 1]), tb.astensor([2]), tb.astensor([3, 3, 3]) | ||
), | ||
assert ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These blocks seem like they're really going to stay as is for the time being given things like psf/black#1629
@kratsg @lukasheinrich Ready for another review. @alexander-held @henryiii your reviews are of course welcome too. :) |
Description
The final beta releases of Black bring about some changes in formatting, as we see in Black
v20.8b1
. This PR applies those style changes, and appropriatley changes the pre-commit style change so that commits don't fail with Black conflicts.This PR also introduces the use of pinning the
rev
used inpre-commit
as this is advocated for bypre-commit
core dev @asottile in psf/black#420 — thanks to @alexander-held and @henryiii for pointing this out and explaining more to us. (It seems from omry/omegaconf#340 that others are in a similar boat as we are right now). The dev docs are also updated to reflect this.Checklist Before Requesting Reviewer
Before Merging
For the PR Assignees: