-
Notifications
You must be signed in to change notification settings - Fork 469
refactor(batch): improve type annotation for event parameter #7924
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(batch): improve type annotation for event parameter #7924
Conversation
Change event parameter type from 'dict' to 'dict[str, Any]' in process_partial_response and async_process_partial_response functions. Lambda events are JSON objects which should be typed as dict[str, Any] for better type checking with tools like pyright. Fixes aws-powertools#7923
|
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #7924 +/- ##
========================================
Coverage 96.72% 96.72%
========================================
Files 275 275
Lines 13214 13214
Branches 1006 1006
========================================
Hits 12781 12781
Misses 325 325
Partials 108 108 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
leandrodamascena
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for improving this @maxrabin! APPROVED!
|
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |



Issue number: closes #7923
Summary
Changes
Changed the
eventparameter type annotation fromdicttodict[str, Any]in bothprocess_partial_responseandasync_process_partial_responsefunctions inaws_lambda_powertools/utilities/batch/decorators.py.User experience
Before: When using strict type checkers like
pyright, users would see type errors:After: Type checkers correctly infer
event: dict[str, Any], eliminating the type error and providing better IDE support and type safety.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.