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

Add exists check in download_to #433

Merged
merged 1 commit into from
May 4, 2024
Merged

Conversation

pjbull
Copy link
Member

@pjbull pjbull commented May 3, 2024

Add .exists check before download_to and raise new CloudPathNotExistsError if the path does not exist.

Closes #430

@pjbull pjbull changed the title 430 exists before download Add exists check in download_to May 3, 2024
Copy link
Contributor

github-actions bot commented May 3, 2024

@github-actions github-actions bot temporarily deployed to pull request May 3, 2024 16:25 Inactive
Copy link

codecov bot commented May 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.5%. Comparing base (71331d3) to head (c3ac4ec).

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #433   +/-   ##
======================================
  Coverage    93.5%   93.5%           
======================================
  Files          23      23           
  Lines        1650    1654    +4     
======================================
+ Hits         1544    1548    +4     
  Misses        106     106           
Files Coverage Δ
cloudpathlib/cloudpath.py 93.5% <100.0%> (+<0.1%) ⬆️
cloudpathlib/exceptions.py 100.0% <100.0%> (ø)

@pjbull pjbull requested a review from jayqi May 3, 2024 17:15
@jayqi
Copy link
Member

jayqi commented May 3, 2024

This adds an extra network call, right? (And we're already doing multiple network calls even before this change.) I don't love this, but I'm willing to be convinced this is okay for now and we track an issue to do this more intelligently.

@pjbull
Copy link
Member Author

pjbull commented May 3, 2024

This adds an extra network call, right? (And we're already doing multiple network calls even before this change.) I don't love this, but I'm willing to be convinced this is okay for now and we track an issue to do this more intelligently.

Yeah, it does. Where I landed was that I'd rather implement that through caching that kind of metadata intelligently at the client level so that the implementation here stays the same and network overhead is reduced.

Also, it is one call in each download_to, so that if you are doing a directory it doesn't happen for every file.

@pjbull pjbull force-pushed the 430-exists-before-download branch from 0be3853 to c3ac4ec Compare May 3, 2024 23:36
@github-actions github-actions bot temporarily deployed to pull request May 3, 2024 23:37 Inactive
@pjbull pjbull merged commit 08b018b into master May 4, 2024
25 checks passed
@pjbull pjbull deleted the 430-exists-before-download branch May 4, 2024 16:49
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.

[GS] download_to with non-existent files don't raise any exception
2 participants