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

refactor(parameters): add overload signatures for get_parameter and get_parameters #3534

Merged

Conversation

troyswanson
Copy link
Contributor

Issue number: #3507

Summary

Changes

Adds overload signatures for the get_parameter and get_parameters functions depending on the arguments present. Also defines the literals that are available in the transform argument.

User experience

Type checkers should return the expected type based on the value in the transform argument.

  • If None, return type should be str
  • If "json", return type should be dict
  • If "binary", return type should be bytes

Checklist

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

Is this a breaking change? No

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.

@troyswanson troyswanson requested a review from a team as a code owner December 18, 2023 16:56
Copy link

boring-cyborg bot commented Dec 18, 2023

Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 18, 2023
@rubenfonseca
Copy link
Contributor

Looking at this now

@rubenfonseca rubenfonseca added the parameters Parameters utility label Dec 19, 2023
@rubenfonseca rubenfonseca linked an issue Dec 19, 2023 that may be closed by this pull request
Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

great work!!! Only one missing... Literal["auto"]. It uses the parameter suffix to find the transformation method to use (.binary -> Binary, or .json -> JSON).

Example in get_parameters_by_name.

@heitorlessa heitorlessa changed the title refactor(parameters): Add overload signatures for get_parameter and get_parameters refactor(parameters): add overload signatures for get_parameter and get_parameters Dec 19, 2023
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 20, 2023
@rubenfonseca
Copy link
Contributor

I've added the missing case. @heitorlessa please review when possible

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

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

APPROVED

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (926ff86) 95.78% compared to head (f5cfcc2) 95.78%.
Report is 6 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    #3534   +/-   ##
========================================
  Coverage    95.78%   95.78%           
========================================
  Files          210      210           
  Lines         9681     9681           
  Branches      1773     1773           
========================================
  Hits          9273     9273           
  Misses         294      294           
  Partials       114      114           

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

heitorlessa
heitorlessa previously approved these changes Dec 20, 2023
Copy link

sonarcloud bot commented Dec 20, 2023

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@rubenfonseca rubenfonseca merged commit cedb5c9 into aws-powertools:develop Dec 20, 2023
16 checks passed
Copy link

boring-cyborg bot commented Dec 20, 2023

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parameters Parameters utility size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Static typing: utilities.parameters.get_parameter
5 participants