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(typing): improve overloads to ensure the return type follows the default_value type #4114

Merged
merged 5 commits into from
Apr 12, 2024

Conversation

Wurstnase
Copy link
Contributor

Issue number: #4113

Summary

Changes

Overload functions with default_value when it becomes not Optional anymore.

User experience

Ensure return type without casting.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@Wurstnase Wurstnase requested a review from a team April 11, 2024 19:41
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 11, 2024
@Wurstnase Wurstnase force-pushed the feat/typing branch 2 times, most recently from eb95f0a to b10e803 Compare April 11, 2024 19:44
@Wurstnase Wurstnase changed the title fix(typing): ensure return type is a T when default_value is set fix(typing): ensure return type is T when default_value is set Apr 11, 2024
@rubenfonseca rubenfonseca added the typing Static typing definition related issues (mypy, pyright, etc.) label Apr 12, 2024
@github-actions github-actions bot added the bug Something isn't working label Apr 12, 2024
@rubenfonseca
Copy link
Contributor

@Wurstnase it seems some tests are failing, can you please look at them?

@Wurstnase Wurstnase requested a review from rubenfonseca April 12, 2024 11:09
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.25%. Comparing base (e14e768) to head (8692b40).
Report is 299 commits behind head on develop.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4114      +/-   ##
===========================================
- Coverage    96.38%   96.25%   -0.13%     
===========================================
  Files          214      216       +2     
  Lines        10030    10394     +364     
  Branches      1846     1921      +75     
===========================================
+ Hits          9667    10005     +338     
- Misses         259      275      +16     
- Partials       104      114      +10     

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

@Wurstnase Wurstnase changed the title fix(typing): ensure return type is T when default_value is set fix(typing): ensure return type is a str when default_value is set Apr 12, 2024
Copy link
Contributor

@rubenfonseca rubenfonseca left a comment

Choose a reason for hiding this comment

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

This is amazing work, thank you VERY much!! I left some small nit picks here and there that should be easy to fix. I loved to see the test changing at the end to remove the type ignore!

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
27.8% Duplication on New Code

See analysis details on SonarCloud

@Wurstnase Wurstnase requested a review from rubenfonseca April 12, 2024 15:23
Copy link
Contributor

@rubenfonseca rubenfonseca left a comment

Choose a reason for hiding this comment

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

Stellar work, thank you so much for spending time improving the experience here. Seriously, thank you!

@rubenfonseca rubenfonseca changed the title fix(typing): ensure return type is a str when default_value is set fix(typing): improve overloads to ensure the return type follows the default_value type Apr 12, 2024
@rubenfonseca rubenfonseca merged commit c0622a5 into aws-powertools:develop Apr 12, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/L Denotes a PR that changes 100-499 lines, ignoring generated files. typing Static typing definition related issues (mypy, pyright, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Static typing: missing @overload to ensure return type is a str when default_value is set
3 participants