File: iterate_promise.py

package info (click to toggle)
python-promise 2.3.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 400 kB
  • sloc: python: 2,681; sh: 13; makefile: 4
file content (12 lines) | stat: -rw-r--r-- 296 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
# flake8: noqa
if False:
    from .promise import Promise
    from typing import Iterator


def iterate_promise(promise):
    # type: (Promise) -> Iterator
    if not promise.is_fulfilled:
        yield from promise.future  # type: ignore
    assert promise.is_fulfilled
    return promise.get()