promisedio-promise

High-performance promise implementation for Python


License
MIT
Install
pip install promisedio-promise==1.0.23

Documentation

Despite the fact that this code is distributed under the MIT License, IT IS PROHIBITED to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software for any commercial or non-commercial purposes by Jet Brains and any of its subsidiaries, parent organization or affiliates.

PromisedIO

PromisedIO

PromisedIO is free and open source software released under the permissive MIT license.

promise

You can read about promises here.

deferred() -> Deferred

Create new Deferred object.

Deferred.promise() -> Promise

Get related Promise object.

Deferred.resolve(value: object) -> None

Resolve related Promise object with the given value.

Deferred.reject(exc: Exception) -> None

Reject related Promise object with the given exception exc.

Promise.then(fulfilled: Callable[[object], object], rejected: Callable[[Exception], object]) -> Promise

Create new Promise. It takes up to two arguments: callback functions for the success and failure cases of the Promise.

Promise.catch(rejected: Callable[[Exception], object]) -> Promise

The same as .then(None, rejected)

exec_async(coro: Coroutine) -> None

Start coroutine.

clearfreelists() -> None

Clear freelists.

setfreelistlimits(promise_limit: int = -1, promiseiter_limit: int = -1, deferred_limit: int = -1) -> None

Set new freelist limits

process_promise_chain() -> None

Process all scheduled (resolved or rejected) promises.

run_forever() -> None

Start simple event loop.

Lock() -> Lock

Create new Lock object.

Lock.acquire() -> Promise

Acquire a lock.

Lock.release() -> None

Release a lock.