Skip to content

promisedio/promise

Repository files navigation

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.

You can read about promises here.

promise module

clearfreelists

clearfreelists() -> None

Clear all freelists.

deferred

deferred() -> Deferred

Create new Deferred object.

exec_async

exec_async(coro: Coroutine, context: Any = None) -> None

Start new coroutine and set the context for the new coroutine.

get_context

get_context() -> Any

Get context of current corroutine.

process_promise_chain

process_promise_chain() -> int

Process all scheduled (resolved or rejected) promises.

Returns active promise count.

run_forever

run_forever() -> None

Start simple event loop.

setfreelistlimits

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

Update freelist limits. Default limit for each type is 1024.

Deferred

Deferred.promise

Deferred.promise() -> Promise

Get related Promise object.

Deferred.reject

Deferred.reject(value: Exception) -> None

Reject related Promise object with the given exception value.

Deferred.resolve

Deferred.resolve(value: Any) -> None

Resolve related Promise object with the given value.

Lock

Lock.new

Lock.__new__() -> Any

Create new Lock object.

Lock.acquire

Lock.acquire() -> Promise

Acquire the lock.

Lock.release

Lock.release() -> Promise

Release the lock.

Promise

Promise.catch

Promise.catch(rejected: Callable) -> Promise

The same as .then(None, rejected)

Promise.then

Promise.then(fulfilled: Callable = None, rejected: Callable = None) -> Promise

Create new Promise.

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

About

High-performance promise implementation for Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published