Is your feature request related to a problem? Please describe.
Deferred.fromFuture is annotated as returning Deferred[Any]. While this is technically correct (since Any means "any type"), it can easily be improved. Moreover, it causes projects using strict mypy checks to necessitate additional annotations.
Describe the solution you'd like
One could improve the type annotation of this method in this way:
_T = TypeVar("T")
...
@classmethod
def fromFuture(cls, future: Future[_T]) -> "Deferred[_T]":
Describe alternatives you've considered
An alternative would be leaving things as is, but as I've mentioned that requires the project that calls fromFuture to add type annotations that could be inferred from fromFuture's.
Additional context
Here is an example of code that requires such superfluous annotation: to make mypy happy, d needs to be annotated as a Deferred[MediaDescription], even though that can be inferred from the fact that the values in self._current_scans are already annotated as Future[MediaDescription].
Is your feature request related to a problem? Please describe.
Deferred.fromFutureis annotated as returningDeferred[Any]. While this is technically correct (sinceAnymeans "any type"), it can easily be improved. Moreover, it causes projects using strict mypy checks to necessitate additional annotations.Describe the solution you'd like
One could improve the type annotation of this method in this way:
Describe alternatives you've considered
An alternative would be leaving things as is, but as I've mentioned that requires the project that calls
fromFutureto add type annotations that could be inferred fromfromFuture's.Additional context
Here is an example of code that requires such superfluous annotation: to make mypy happy,
dneeds to be annotated as aDeferred[MediaDescription], even though that can be inferred from the fact that the values inself._current_scansare already annotated asFuture[MediaDescription].