-
Notifications
You must be signed in to change notification settings - Fork 516
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
feat: add inject_or #1376
Merged
andrewwhitehead
merged 9 commits into
openwallet-foundation:main
from
dbluhm:fix/injector-typing
Aug 31, 2021
Merged
feat: add inject_or #1376
andrewwhitehead
merged 9 commits into
openwallet-foundation:main
from
dbluhm:fix/injector-typing
Aug 31, 2021
+280
−150
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BREAKING CHANGE: `required` parameter has been removed from Injector.inject Signed-off-by: Daniel Bluhm <[email protected]>
Signed-off-by: Daniel Bluhm <[email protected]>
Signed-off-by: Daniel Bluhm <[email protected]>
Signed-off-by: Daniel Bluhm <[email protected]>
Signed-off-by: Daniel Bluhm <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #1376 +/- ##
=======================================
Coverage 95.28% 95.28%
=======================================
Files 476 476
Lines 29023 29048 +25
=======================================
+ Hits 27654 27678 +24
- Misses 1369 1370 +1 |
Given no expressed opposition lol, I went ahead and finished the implementation on this to be able to consider these changes holistically. |
andrewwhitehead
approved these changes
Aug 31, 2021
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.
Looks good, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR removes the
required
parameter fromInjector.inject
and introducesinject_or
that mimics the behavior ofinject(..., required=False)
. The reasoning for this change is that type checkers take issue with using the result ofinject(..., required=True)
when the signature says that it could still beNone
. For example:Yields the error
"find_all_records" is not a known member of "None"
when using pyright, even though we know that the call will have resulted in an error if it was actuallyNone
.This PR is mostly a proposal and does not yet fix the 109 or so instances of
inject(..., required=False)
that should be switched toinject_or
. Open to suggestions or alternatives.