Unify the publicly exported sync/async daemon-stopping flag #757
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.
Previously,
Union
of sync & async checkers was used in the daemon protocol. As a result, it forced the operator developers to accept both types and do proper handling of both cases — when in fact only one checker was passed according to the daemon type (sync/async).To simplify type-checking of operators, both sync & async checkers are now downgraded to implementation details (but remain exported for backwards compatibility), while only the base class is exposed for type annotations of the
stopped
kwarg. To achieve this, some "clean" (as in, "not dirty") trickery was implemented — see the docstring of the new “promise” class.All public interfaces should remain supported without breaking them. Even evaluating the results of
stopped.wait()
as booleans remain there: the returned value is the flag/checker itself, but it is bool-evaluable (unlessx is True
/x is False
conditions were used).Related #747. Fixes #746. Replaces #748.