merge queue: checking main (e6ef84a) and #680 together - #690
Closed
mergify[bot] wants to merge 3 commits into
Closed
merge queue: checking main (e6ef84a) and #680 together#690mergify[bot] wants to merge 3 commits into
mergify[bot] wants to merge 3 commits into
Conversation
`truthy-bool` reports objects tested for truthiness that implement neither `__bool__` nor `__len__`, and so can only ever be true. Three sites: `BaseRetrying._run_wait` and `AsyncRetrying._run_wait` both guarded the wait call with `if self.wait:`. `wait` is typed `WaitBaseT` and defaults to a `wait_none()` instance, so it is never falsy and the `sleep = 0.0` branch has been dead since 17aefd9 -- a leftover from when the surrounding code still used `if self.after is not None:` style guards. Call `self.wait` unconditionally. `if tornado:` guarded the optional import in two places. mypy only ever sees the `try` branch, so it resolves the name to the module and reads the test as always-true. Compute `_HAS_TORNADO` once and branch on that instead; this also keeps `tornado.gen` fully typed, which annotating the name as `ModuleType | None` would have thrown away. Change-Id: Icb9981f6797707e070dc2423015f2fbf6c94e4c4
`mutable-override` rejects narrowing a mutable attribute in a subclass:
`RetryAction.REPR_FIELDS = ("sleep",)` inferred `tuple[str]` against the
base's `Sequence[str]`, and `NAME = "retry"` inferred `str` against
`str | None`. Both are unsound in general -- code holding a `BaseAction`
could assign a longer sequence or `None` through the base type.
`BaseAction`'s docstring already calls these class variables, so mark them
`ClassVar` and repeat the base annotation on the override. This documents
the extension point for subclasses outside tenacity too, which hit the
same error when they type check strictly.
Change-Id: I012caeaad2f93327c69467776a53e87c573b6403
This file contains hidden or 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
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 pull request has been checked successfully and will be merged soon. 🎉
Branch main (e6ef84a) and #680 are queued together for merge.
This pull request has been created by Mergify to check the mergeability of #680.
You don't need to do anything. Mergify will close this pull request automatically when it is complete.
Required conditions of queue rule
defaultfor merge:depends-on = jd/tenacity#679[⛓️ refactor: drop always-true truthiness checks and enable truthy-bool #679]github-review-approved[🛡 GitHub branch protection]Required conditions to stay in the queue:
check-success=test (3.10, check)check-success=test (3.11, check)check-success=test (3.12, check)check-success=test (3.13, check)check-success=test (3.14, check)check-success=test (3.14, lint)check-success=test (3.14, mypy)depends-on = jd/tenacity#679[⛓️ refactor: drop always-true truthiness checks and enable truthy-bool #679]github-review-approved[🛡 GitHub branch protection]author = jd#approved-reviews-by >= 1author = dependabot[bot]