Typehint and documentation for Future.status by bcbnz · Pull Request #9158 · dask/distributed

Added some type hinting for distributed.client.FutureState.status and the distributed.client.Future.status property that returns it.

Updated the docstring of Future.status to also include these states. The type hint has to include None as an option as technically the state may not be set until _bind_late() runs. I have mentioned this in the docstring currently; this may be an unlikely case that doesn't make sense to include in the docstring. I have enabled the allow edits by maintainers option so feel free to remove the None case from the docstring.

No mypy errors are raised on existing code which sets the state so I believe all the options are captured in the Literal.

With these changes, the API section of the documentation now mentions the possible statuses both from the hints and from the docstring.

Closes #9157

  • Tests added / passed
  • Passes pre-commit run --all-files