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

Lint with Black on GitHub Actions and format with Black #136

Merged
merged 8 commits into from
Oct 25, 2020

Conversation

hugovk
Copy link

@hugovk hugovk commented Oct 25, 2020

https://github.com/activeloopai/Hub/blob/master/CONTRIBUTING.md says:

Hub uses Black and Flake8 to ensure a consistent code format throughout the project

However, the code is not Black formatted.

Let's format it!

And let's go a step further, and add linting on CI using GitHub Actions to make sure the code remains formatted.

It does it using pre-commit, so if people like, they can use pip install pre-commit && pre-commit install to have it automatically run Black during commit. This is optional though.

@davidbuniat
Copy link
Member

@hugovk thanks a lot for the PRs and really appreciate your contribution!

To make the PRs meaningful under #Hacktoberfest guidelines, would be great if you could combine #134, #135, #137 into single one. I would be happy to run a circleci test and merge it.

On another note, if you are interested and would like to contribute further I can create a separate issue to automate package building on github and we can count that as a separate PR.

@hugovk
Copy link
Author

hugovk commented Oct 25, 2020

Sure, sounds good to both suggestions!

@davidbuniat
Copy link
Member

@hugovk can you please merge #135 here as well

@github-actions
Copy link

Locust summary

Git references

Initial: 7a400c3
Terminal: 501a927

hub/collections/dataset/core.py
Changes:
hub/client/auth.py
Changes:
hub/client/hub_control.py
Changes:
hub/client/token_manager.py
Changes:
hub/collections/tensor/core.py
Changes:
  • Name: Tensor
    Type: class
    Changed lines: 3
    Total lines: 160
    Changes:
test/benchmark/old/imagenet_train.py
Changes:
test/benchmark/old/multiprocess_benchmark.py
Changes:
hub/client/base.py
Changes:
test/benchmark/old/baseline.py
Changes:
examples/fashion-mnist/train_pytorch.py
Changes:
  • Name: CNN
    Type: class
    Changed lines: 1
    Total lines: 17
    Changes:
    • Name: CNN.__init__
      Type: function
      Changed lines: 1
      Total lines: 7
    • Name: test
      Type: function
      Changed lines: 9
      Total lines: 24
      • Name: main
        Type: function
        Changed lines: 11
        Total lines: 48
        hub/exceptions.py
        Changes:
        examples/coco/upload_coco2017.py
        Changes:
        • Name: main
          Type: function
          Changed lines: 3
          Total lines: 29
          examples/fashion-mnist/train_tf_fit.py
          Changes:
          • Name: create_CNN
            Type: function
            Changed lines: 16
            Total lines: 25
            • Name: main
              Type: function
              Changed lines: 7
              Total lines: 29
              examples/fashion-mnist/train_tf_gradient_tape.py
              Changes:
              • Name: create_CNN
                Type: function
                Changed lines: 16
                Total lines: 25
                • Name: train
                  Type: function
                  Changed lines: 1
                  Total lines: 14
                  • Name: test
                    Type: function
                    Changed lines: 1
                    Total lines: 9
                    • Name: main
                      Type: function
                      Changed lines: 6
                      Total lines: 42
                      examples/fashion-mnist/upload.py
                      Changes:
                      • Name: main
                        Type: function
                        Changed lines: 15
                        Total lines: 35
                        examples/mnist/upload.py
                        Changes:
                        • Name: main
                          Type: function
                          Changed lines: 5
                          Total lines: 32
                          hub/cli/auth.py
                          Changes:
                          • Name: register
                            Type: function
                            Changed lines: 1
                            Total lines: 20
                            hub/cli/utils.py
                            Changes:
                            hub/collections/client_manager.py
                            Changes:
                            • Name: init
                              Type: function
                              Changed lines: 15
                              Total lines: 61
                              hub/collections/dataset/__init__.py
                              Changes:
                              • Name: generate
                                Type: function
                                Changed lines: 1
                                Total lines: 38
                                • Name: from_tensors
                                  Type: function
                                  Changed lines: 1
                                  Total lines: 17
                                  • Name: concat
                                    Type: function
                                    Changed lines: 1
                                    Total lines: 27
                                    • Name: merge
                                      Type: function
                                      Changed lines: 1
                                      Total lines: 8
                                      hub/collections/tensor/__init__.py
                                      Changes:
                                      • Name: from_array
                                        Type: function
                                        Changed lines: 1
                                        Total lines: 29
                                        • Name: concat
                                          Type: function
                                          Changed lines: 1
                                          Total lines: 5
                                          • Name: stack
                                            Type: function
                                            Changed lines: 1
                                            Total lines: 5
                                            • Name: from_zeros
                                              Type: function
                                              Changed lines: 1
                                              Total lines: 28
                                              hub/log.py
                                              Changes:
                                              hub/utils.py
                                              Changes:
                                              • Name: _flatten
                                                Type: function
                                                Changed lines: 1
                                                Total lines: 5
                                                test/benchmark/basic_train.py
                                                Changes:

                                                @codecov
                                                Copy link

                                                codecov bot commented Oct 25, 2020

                                                Codecov Report

                                                Merging #136 into master will not change coverage.
                                                The diff coverage is 14.58%.

                                                Impacted file tree graph

                                                @@           Coverage Diff           @@
                                                ##           master     #136   +/-   ##
                                                =======================================
                                                  Coverage   64.30%   64.30%           
                                                =======================================
                                                  Files          39       39           
                                                  Lines        1496     1496           
                                                =======================================
                                                  Hits          962      962           
                                                  Misses        534      534           
                                                Impacted Files Coverage Δ
                                                hub/areal/tests/test_storage_tensor.py 92.45% <ø> (ø)
                                                hub/cli/auth.py 0.00% <ø> (ø)
                                                hub/cli/command.py 0.00% <ø> (ø)
                                                hub/cli/utils.py 34.37% <0.00%> (ø)
                                                hub/client/auth.py 32.14% <0.00%> (ø)
                                                hub/client/hub_control.py 35.00% <0.00%> (ø)
                                                hub/codec/image.py 26.66% <ø> (ø)
                                                hub/collections/_store_version.py 100.00% <ø> (ø)
                                                hub/collections/client_manager.py 72.34% <ø> (ø)
                                                hub/collections/dataset/__init__.py 96.07% <ø> (ø)
                                                ... and 11 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 9c050c8...501a927. Read the comment docs.

                                                @davidbuniat davidbuniat merged commit 77f54b4 into activeloopai:master Oct 25, 2020
                                                @hugovk hugovk deleted the lint-ci branch October 25, 2020 22:35
                                                Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
                                                Labels
                                                None yet
                                                Projects
                                                None yet
                                                Development

                                                Successfully merging this pull request may close these issues.

                                                2 participants