Fix return typing of AsyncEngine._trans_ctx.__aenter__ #110
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.
Fixes: #109
Description
In-order to fix AsyncEngine._trans_ctx's typing I have made StartableContext generic rather than assuming it's methods will always be returning a sub-class of itself which isn't the case for _trans_ctx which inherits from it.
As a note, for now I've left the usage of type vars for the return typing of StartableContext.start implementations without using the same type vars when inheriting from StartableContext as this would mark the class as being generic which probably isn't correct. While nothing seems to subclass any of the classes which directly inherit from StartableContext, if they were StartableContext would have to be directly inherited again (only in the stubs) to specialise the behaviour of it further under the current behaviour this proposal introduces e.g:
Checklist
This pull request is:
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
Fixes: #<issue number>
in the commit messageinclude a complete example of how the feature would look.
Fixes: #<issue number>
in the commit messageHave a nice day!