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

Disallow certain methods for dataset and tensor views #1311

Merged
merged 22 commits into from
Mar 16, 2022

Conversation

FayazRahman
Copy link
Contributor

@FayazRahman FayazRahman commented Oct 31, 2021

🚀 🚀 Pull Request

Checklist:

  • My code follows the style guidelines of this project and the Contributing document
  • I have commented my code, particularly in hard-to-understand areas
  • I have kept the coverage-rate up
  • I have performed a self-review of my own code and resolved any problems
  • I have checked to ensure there aren't any other open Pull Requests for the same change
  • I have described and made corresponding changes to the relevant documentation
  • New and existing unit tests pass locally with my changes

Changes

Closes #1163

@CLAassistant
Copy link

CLAassistant commented Oct 31, 2021

CLA assistant check
All committers have signed the CLA.

@aliubimov aliubimov added the trigger-test Label trigger to run tests on PRs label Nov 17, 2021
@activeloop-bot activeloop-bot removed the trigger-test Label trigger to run tests on PRs label Nov 17, 2021
hub/util/exceptions.py Outdated Show resolved Hide resolved
Copy link
Contributor

@AbhinavTuli AbhinavTuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename the error, resolve merge conflicts and then we should be good to merge this.

@AbhinavTuli AbhinavTuli added the trigger-test Label trigger to run tests on PRs label Dec 2, 2021
@activeloop-bot activeloop-bot removed the trigger-test Label trigger to run tests on PRs label Dec 2, 2021
@mikayelh
Copy link
Collaborator

@tatevikh was this one resolved or is still in the backlog? asking to sort out the new contributor backlog!

@FayazRahman FayazRahman added the trigger-test Label trigger to run tests on PRs label Jan 20, 2022
@activeloop-bot activeloop-bot removed the trigger-test Label trigger to run tests on PRs label Jan 20, 2022
@codecov
Copy link

codecov bot commented Jan 20, 2022

Codecov Report

Merging #1311 (cdbdb33) into main (2893b40) will increase coverage by 0.47%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #1311      +/-   ##
==========================================
+ Coverage   91.75%   92.22%   +0.47%     
==========================================
  Files         193      194       +1     
  Lines       16879    17177     +298     
==========================================
+ Hits        15487    15842     +355     
+ Misses       1392     1335      -57     
Flag Coverage Δ
unittests 92.22% <100.00%> (+0.47%) ⬆️

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

Impacted Files Coverage Δ
hub/api/tests/test_api.py 100.00% <100.00%> (+1.74%) ⬆️
hub/core/dataset/dataset.py 93.27% <100.00%> (+0.57%) ⬆️
hub/core/tensor.py 84.28% <100.00%> (+1.20%) ⬆️
hub/util/exceptions.py 80.52% <100.00%> (+0.32%) ⬆️
hub/util/invalid_view_op.py 100.00% <100.00%> (ø)
hub/core/compute/provider.py 94.44% <0.00%> (-2.62%) ⬇️
hub/integrations/tests/test_pytorch_dataloader.py 95.69% <0.00%> (-1.98%) ⬇️
hub/core/query/autocomplete.py 79.54% <0.00%> (-1.71%) ⬇️
hub/integrations/pytorch/dataset.py 91.33% <0.00%> (-1.22%) ⬇️
hub/core/meta/encode/chunk_id.py 94.48% <0.00%> (-0.79%) ⬇️
... and 62 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 2893b40...cdbdb33. Read the comment docs.

@FayazRahman FayazRahman added the trigger-test Label trigger to run tests on PRs label Jan 23, 2022
@activeloop-bot activeloop-bot removed the trigger-test Label trigger to run tests on PRs label Jan 23, 2022
Copy link
Contributor

@AbhinavTuli AbhinavTuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Copy link
Contributor

@jraman jraman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits. Looks good otherwise.

hub/util/no_view.py Outdated Show resolved Hide resolved
hub/util/no_view.py Outdated Show resolved Hide resolved
@wraps(callable)
def inner(x, *args, **kwargs):
func = callable.__name__
if not x.index.is_trivial():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if x does not have an index member? Or x.index doesn't have a is_trivial method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function is to be used internally, only for datasets and tensors

hub/util/exceptions.py Outdated Show resolved Hide resolved
hub/util/no_view.py Outdated Show resolved Hide resolved
@FayazRahman FayazRahman added the trigger-test Label trigger to run tests on PRs label Mar 15, 2022
@activeloop-bot activeloop-bot removed the trigger-test Label trigger to run tests on PRs label Mar 15, 2022
@@ -1048,6 +1055,7 @@ def size_approx(self):
return size

@hub_reporter.record_call
@invalid_view_op
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this decorator should be above @hub_reporter.record_call for reporting to work properly.

@FayazRahman FayazRahman added the trigger-test Label trigger to run tests on PRs label Mar 15, 2022
@activeloop-bot activeloop-bot removed the trigger-test Label trigger to run tests on PRs label Mar 15, 2022
@farizrahman4u farizrahman4u merged commit 366d593 into activeloopai:main Mar 16, 2022
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.

[FEATURE] Disallow certain methods for dataset and tensor views
8 participants