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

Fix type hint on sync api.get() #556

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

jacobtomlinson
Copy link
Member

@jacobtomlinson jacobtomlinson commented Jan 22, 2025

The return type for the sync implementation of api.get() was effectively Generator[kr8s.asyncio.objects.APIObject, None, None]. This PR fixes it to be the sync base class shim Generator[kr8s.objects.APIObject, None, None].

I had to reinstate the sync base class that was removed in #551 (comment) for type hinting purposes.

Closes #555

@jacobtomlinson jacobtomlinson added bug Something isn't working typing labels Jan 22, 2025
assert next(pods)._asyncio is False
pod = next(pods)
assert pod._asyncio is False
pod.refresh()
Copy link
Member Author

Choose a reason for hiding this comment

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

My IDE is now happy with this line, it wasn't before.

Copy link

codecov bot commented Jan 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.09%. Comparing base (87063fc) to head (c4ac93b).
Report is 164 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #556      +/-   ##
==========================================
- Coverage   94.61%   94.09%   -0.53%     
==========================================
  Files          29       30       +1     
  Lines        3141     4169    +1028     
==========================================
+ Hits         2972     3923     +951     
- Misses        169      246      +77     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jacobtomlinson jacobtomlinson merged commit 947edfd into kr8s-org:main Jan 22, 2025
13 checks passed
@jacobtomlinson jacobtomlinson deleted the api-get-typing branch January 22, 2025 10:55
@jacobtomlinson jacobtomlinson changed the title Fix type hint on sync api.get() Fix type hint on sync api.get() Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working kr8s tests typing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kr8s.api.get returns async APIObject, would expect sync objects
1 participant