-
Notifications
You must be signed in to change notification settings - Fork 401
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(parser): only infer type hints when necessary #4183
refactor(parser): only infer type hints when necessary #4183
Conversation
This was breaking in codebases that conditionally import type hints using the `typing.TYPE_CHECKING` constant as described in [PEP 563](https://peps.python.org/pep-0563/#runtime-annotation-resolution-and-type-checking). When the model is provided, there is no need to infer anything. Signed-off-by: Raymond Butcher <[email protected]>
Thanks a lot for your first contribution! Please check out our contributing guidelines and don't hesitate to ask whatever you need. |
Quality Gate passedIssues Measures |
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## develop #4183 +/- ##
===========================================
- Coverage 96.38% 96.16% -0.22%
===========================================
Files 214 218 +4
Lines 10030 10461 +431
Branches 1846 1936 +90
===========================================
+ Hits 9667 10060 +393
- Misses 259 283 +24
- Partials 104 118 +14 ☔ View full report in Codecov by Sentry. |
Thanks for this PR @raymondbutcher! A small improvement that avoids unnecessary code execution in an environment where every millisecond counts. Good catch! |
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience! |
That was quick, thanks @leandrodamascena! |
Issue number: #4184
Summary
Changes
This changes the
event_parser
decorator to only infer type hints when necessary.It was breaking in codebases that conditionally import type hints using the
typing.TYPE_CHECKING
constant as described in PEP 563.When the model is provided, there is no need to infer anything.
User experience
N/A
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change? No.
RFC issue number:
Checklist:
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.