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

feat: Add overloads for CloudPath.open() #464

Merged
merged 6 commits into from
Aug 29, 2024

Conversation

0xbe7a
Copy link
Contributor

@0xbe7a 0xbe7a commented Aug 23, 2024

Closes #465

To correctly handle the different argument and return types, I adapted the typeshed overloads for pathlib.Path.open() to CloudPath.open(). These overloads are appropriate because cloudpathlib passes the arguments to self._local after caching the file to local disk.

Handling all possible mode values is verbose, but the overloads are copied directly from typeshed, ensuring correctness and minimizing maintenance burden.


Contributor checklist:

  • I have read and understood CONTRIBUTING.md
  • Confirmed an issue exists for the PR, and the text Closes #issue appears in the PR summary (e.g., Closes #123).
  • Confirmed PR is rebased onto the latest base
  • Confirmed failure before change and success after change
  • Any generic new functionality is replicated across cloud providers if necessary
  • (Not applicable) Tested manually against live server backend for at least one provider
  • (Not applicable) Added tests for any new functionality
  • Linting passes locally
  • Tests pass locally
  • Updated HISTORY.md with the issue that is addressed and the PR you are submitting. If the top section is not `## UNRELEASED``, then you need to add a new section to the top of the document for your change.

Copy link
Member

@pjbull pjbull left a comment

Choose a reason for hiding this comment

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

Thanks! A few changes requested. If you update soon, happy to include this in the next release coming in the next few days.

cloudpathlib/typing.py Outdated Show resolved Hide resolved
cloudpathlib/cloudpath.py Show resolved Hide resolved
Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 94.11765% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.2%. Comparing base (5656879) to head (7daee5c).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cloudpathlib/cloudpath.py 94.1% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #464     +/-   ##
========================================
- Coverage    94.2%   93.2%   -1.0%     
========================================
  Files          23      23             
  Lines        1728    1745     +17     
========================================
- Hits         1629    1628      -1     
- Misses         99     117     +18     
Files with missing lines Coverage Δ
cloudpathlib/cloudpath.py 94.5% <94.1%> (-0.1%) ⬇️

... and 3 files with indirect coverage changes

@pjbull pjbull merged commit dc8ff96 into drivendataorg:master Aug 29, 2024
23 of 24 checks passed
@pjbull
Copy link
Member

pjbull commented Aug 29, 2024

Thanks @0xbe7a!

@0xbe7a 0xbe7a deleted the IO-typing branch August 30, 2024 09:07
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.

Add typing overloads to CloudPath.open()
2 participants