error: Argument 1 to "subscribe" of "AsyncScheduler" has incompatible type "Callable[[JobAcquired], None]"; expected "Callable[[Event], Any]" [arg-type]
With proposed changeset, there is no error.
This may have additional benefit where a handler that cannot handle the subscribed types will be picked up statically, e.g:
error: Argument 1 to "subscribe" of "AsyncScheduler" has incompatible type "Callable[[JobReleased], None]"; expected "Callable[[JobAcquired], Any]" [arg-type]
Things to check first
Feature description
Propose using a bound typevar for
AsyncScheduler.subscribe()
:Use case
Curerently, a subscription like this:
Raises a type error:
With proposed changeset, there is no error.
This may have additional benefit where a handler that cannot handle the subscribed types will be picked up statically, e.g:
With above patch applied, mypy raises: