cloudpathlib icon indicating copy to clipboard operation
cloudpathlib copied to clipboard

Add exists check in download_to

Open pjbull opened this issue 1 year ago • 4 comments

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

Closes #430

pjbull avatar May 03 '24 16:05 pjbull

🚀 Deployed on https://deploy-preview-433--gallant-agnesi-5f7bb3.netlify.app

github-actions[bot] avatar May 03 '24 16:05 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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%) :arrow_up:
cloudpathlib/exceptions.py 100.0% <100.0%> (ø)

codecov[bot] avatar May 03 '24 16:05 codecov[bot]

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.

jayqi avatar May 03 '24 18:05 jayqi

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 avatar May 03 '24 18:05 pjbull