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

Apply yapf to pl_bolts 1/2 #510

Merged
merged 11 commits into from
Jan 10, 2021

Conversation

akihironitta
Copy link
Contributor

@akihironitta akihironitta commented Jan 10, 2021

What does this PR do?

Follow-up PR of #509 and part of #482.

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes?
  • Did you write any new necessary tests? [not needed for typos/docs]
  • Did you verify new and existing tests pass locally with your changes?
  • If you made a notable change (that affects users), did you update the CHANGELOG?

PR review

  • Is this pull request ready for review? (if not, please submit in draft mode)

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@codecov
Copy link

codecov bot commented Jan 10, 2021

Codecov Report

Merging #510 (b24610a) into master (795b7b1) will decrease coverage by 0.03%.
The diff coverage is 71.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #510      +/-   ##
==========================================
- Coverage   79.07%   79.04%   -0.04%     
==========================================
  Files         102      102              
  Lines        5921     5912       -9     
==========================================
- Hits         4682     4673       -9     
  Misses       1239     1239              
Flag Coverage Δ
cpu 25.77% <18.29%> (+0.12%) ⬆️
pytest 25.77% <18.29%> (+0.12%) ⬆️
unittests 78.55% <71.54%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pl_bolts/callbacks/byol_updates.py 100.00% <ø> (ø)
pl_bolts/callbacks/vision/confused_logit.py 76.92% <ø> (ø)
pl_bolts/datasets/base_dataset.py 81.81% <ø> (ø)
pl_bolts/datasets/concat_dataset.py 41.66% <ø> (ø)
pl_bolts/datasets/imagenet_dataset.py 19.65% <0.00%> (ø)
pl_bolts/datasets/kitti_dataset.py 32.69% <0.00%> (ø)
pl_bolts/datasets/mnist_dataset.py 50.00% <ø> (ø)
pl_bolts/datasets/ssl_amdim_datasets.py 77.02% <ø> (ø)
pl_bolts/models/detection/faster_rcnn.py 78.18% <ø> (ø)
pl_bolts/models/gans/basic/basic_gan_module.py 95.34% <ø> (ø)
... and 63 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 795b7b1...b24610a. Read the comment docs.

@akihironitta akihironitta changed the title Apply yapf to pl_bolts Apply yapf to pl_bolts 1/2 Jan 10, 2021
@akihironitta akihironitta changed the title Apply yapf to pl_bolts 1/2 Apply yapf to pl_bolts 1/2 [wip] Jan 10, 2021
@akihironitta akihironitta marked this pull request as draft January 10, 2021 15:03
@akihironitta
Copy link
Contributor Author

akihironitta commented Jan 10, 2021

It looks yapf doesn't care long-name objects, so I placed noqa: E501 to ignore flake8 for better readability in 51154d2. I looked through the yapf docs, but they don't have any option to format this.

@akihironitta akihironitta changed the title Apply yapf to pl_bolts 1/2 [wip] Apply yapf to pl_bolts 1/2 Jan 10, 2021
@akihironitta akihironitta marked this pull request as ready for review January 10, 2021 15:20
@Borda
Copy link
Member

Borda commented Jan 10, 2021

It looks yapf doesn't care long-name objects, so I placed noqa: E501 to ignore flake8 for better readability in 51154d2. I looked through the yapf docs, but they don't have any option to format this.

this may resolve the case ALLOW_SPLIT_BEFORE_DICT_VALUE = true

@akihironitta
Copy link
Contributor Author

It looks yapf doesn't care long-name objects, so I placed noqa: E501 to ignore flake8 for better readability in 51154d2. I looked through the yapf docs, but they don't have any option to format this.

this may resolve the case ALLOW_SPLIT_BEFORE_DICT_VALUE = true

You're right, but it can lower readability a lot in other places:

--- a/pl_bolts/models/self_supervised/amdim/amdim_module.py
+++ b/pl_bolts/models/self_supervised/amdim/amdim_module.py
@@ -239,13 +239,20 @@ class AMDIM(pl.LightningModule):
         # CIFAR 10
         cf_root_lr = 2e-4
         cifar_10 = {
-            'dataset': 'cifar10',
-            'ndf': 320,
-            'n_rkhs': 1280,
-            'depth': 10,
-            'image_height': 32,
-            'batch_size': 200,
-            'nb_classes': 10,
+            'dataset':
+            'cifar10',
+            'ndf':
+            320,
+            'n_rkhs':
+            1280,
+            'depth':
+            10,
+            'image_height':
+            32,
+            'batch_size':
+            200,
+            'nb_classes':
+            10,

so, shall we go with noqa: E501?

@Borda Borda force-pushed the ci/apply-yapf-pl_bolts branch from c1ab50a to 4a994be Compare January 10, 2021 15:48
pl_bolts/__init__.py Outdated Show resolved Hide resolved
pl_bolts/callbacks/data_monitor.py Outdated Show resolved Hide resolved
pl_bolts/callbacks/printing.py Outdated Show resolved Hide resolved
pl_bolts/callbacks/ssl_online.py Outdated Show resolved Hide resolved
pl_bolts/callbacks/ssl_online.py Outdated Show resolved Hide resolved
pl_bolts/models/self_supervised/resnets.py Outdated Show resolved Hide resolved
pl_bolts/models/self_supervised/simclr/simclr_module.py Outdated Show resolved Hide resolved
pl_bolts/models/self_supervised/simclr/transforms.py Outdated Show resolved Hide resolved
pl_bolts/models/self_supervised/swav/transforms.py Outdated Show resolved Hide resolved
pl_bolts/transforms/dataset_normalizations.py Outdated Show resolved Hide resolved
@Borda
Copy link
Member

Borda commented Jan 10, 2021

You're right, but it can lower readability a lot in other places:

ok, so just keep it as it is now :]

@Borda Borda merged commit 41bd36c into Lightning-Universe:master Jan 10, 2021
@akihironitta akihironitta deleted the ci/apply-yapf-pl_bolts branch January 10, 2021 17:03
@Borda Borda added this to the v0.3 milestone Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants