{
"info": {
"author": "Syrus Akbary",
"author_email": "me@syrusakbary.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Software Development :: Libraries"
],
"description": "Promise\n=======\n\nThis is a implementation of Promises in Python. It is a super set of\nPromises/A+ designed to have readable, performant code and to provide\njust the extensions that are absolutely necessary for using async_promises in\nPython.\n\nThis was forked to make it fully compatible with the `Promise/A+\nspec `__\n\nOn completion of `promise PR #20 `__,\nmaintenence for this fork will be dropped.\n\n|travis| |pypi| |coveralls|\n\nInstallation\n------------\n\n::\n\n $ pip install async_promises\n\nUsage\n-----\n\nThe example below shows how you can load the async_promises library. It then\ndemonstrates creating a async_promises from scratch. You simply call\n``Promise(fn)``. There is a complete specification for what is returned\nby this method in\n`Promise/A+ `__.\n\n.. code:: python\n\n from async_promises import Promise\n\n async_promises = Promise(\n lambda resolve, reject: resolve('RESOLVED!')\n )\n\nAPI\n---\n\nBefore all examples, you will need:\n\n.. code:: python\n\n from async_promises import Promise\n\nPromise(resolver)\n~~~~~~~~~~~~~~~~~\n\nThis creates and returns a new Promise. ``resolver`` must be a function.\nThe ``resolver`` function is passed two arguments:\n\n1. ``resolve`` should be called with a single argument. If it is called\n with a non-promise value then the promise is fulfilled with that\n value. If it is called with a promise (A) then the returned promise\n takes on the state of that new promise (A).\n2. ``reject`` should be called with a single argument. The returned\n promise will be rejected with that argument.\n\nClass Methods\n~~~~~~~~~~~~~\n\nThese methods are invoked by calling ``Promise.methodName``.\n\nPromise.resolve(value)\n^^^^^^^^^^^^^^^^^^^^^^\n\nConverts values and foreign Promises into Promise/A+ Promises. If you\npass it a value then it returns a Promise for that value. If you pass it\nsomething that is close to a promise (such as a jQuery attempt at a\npromise) it returns a Promise that takes on the state of ``value``\n(rejected or fulfilled).\n\nPromise.rejected(value)\n^^^^^^^^^^^^^^^^^^^^^^^\n\nReturns a rejected promise with the given value.\n\nPromise.all(list)\n^^^^^^^^^^^^^^^^^\n\nReturns a Promise for a list. If it is called with a single argument\nthen this returns a Promise for a copy of that list with any Promises\nreplaced by their fulfilled values. e.g.\n\n.. code:: python\n\n p = Promise.all([Promise.resolve('a'), 'b', Promise.resolve('c')]) \\\n .then(lambda res: res == ['a', 'b', 'c'])\n\n assert p.get() is True\n\nPromise.promisify(obj)\n^^^^^^^^^^^^^^^^^^^^^^\n\nThis function wraps the ``obj`` act as a ``Promise`` if possible. Python\n``Future``\\ s are supported, with a callback to ``async_promises.done`` when\nresolved.\n\nPromise.for\\_dict(d)\n^^^^^^^^^^^^^^^^^^^^\n\nA special function that takes a dictionary of Promises and turns them\ninto a Promises for a dictionary of values. In other words, this turns an\ndictionary of Promises for values into a Promises for a dictionary of\nvalues.\n\nInstance Methods\n~~~~~~~~~~~~~~~~\n\nThese methods are invoked on a Promise instance by calling\n``myPromise.methodName``\n\nasync_promises.then(on\\_fulfilled, on\\_rejected)\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis method follows the `Promise/A+\nspec `__. It explains\nthings very clearly so I recommend you read it.\n\nEither ``on_fulfilled`` or ``on_rejected`` will be called and they will\nnot be called more than once. They will be passed a single argument and\nwill always be called asynchronously (in the next turn of the event\nloop).\n\nIf the Promise is fulfilled then ``on_fulfilled`` is called. If the\nPromise is rejected then ``on_rejected`` is called.\n\nThe call to ``.then`` also returns a Promise. If the handler that is\ncalled returns a Promise, the Promise returned by ``.then`` takes on the\nstate of that returned Promise. If the handler that is called returns a\nvalue that is not a Promise, the Promise returned by ``.then`` will be\nfulfilled with that value. If the handler that is called throws an\nexception then the Promise returned by ``.then`` is rejected with that\nexception.\n\nasync_promises.catch(on\\_rejected)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nSugar for ``async_promises.then(None, on_rejected)``, to mirror ``catch`` in\nsynchronous code.\n\nasync_promises.done(on\\_fulfilled, on\\_rejected)\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThe same semantics as ``.then`` except that it does not return a Promise\nand any exceptions are re-thrown so that they can be logged (crashing\nthe application in non-browser environments)\n\nOther package functions\n-----------------------\n\nis\\_thenable(obj)\n~~~~~~~~~~~~~~~~~\n\nThis function checks if the ``obj`` is a ``Promise``, or could be\n``promisify``\\ ed.\n\nNotes\n=====\n\nThis package is heavily insipired in\n`aplus `__.\n\nLicense\n-------\n\n`MIT\nLicense `__\n\n.. |travis| image:: https://img.shields.io/travis/p2p-project/promise.svg?style=flat\n :target: https://travis-ci.org/p2p-project/promise\n.. |pypi| image:: https://img.shields.io/pypi/v/async_promise.svg?style=flat\n :target: https://pypi.python.org/pypi/async_promise\n.. |coveralls| image:: https://coveralls.io/repos/p2p-project/promise/badge.svg?branch=master&service=github\n :target: https://coveralls.io/github/p2p-project/promise?branch=master",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/p2p-today/promise",
"keywords": "concurrent future deferred promise",
"license": "MIT",
"maintainer": "",
"maintainer_email": "",
"name": "async-promises",
"package_url": "https://pypi.org/project/async-promises/",
"platform": "",
"project_url": "https://pypi.org/project/async-promises/",
"project_urls": {
"Homepage": "https://github.com/p2p-today/promise"
},
"release_url": "https://pypi.org/project/async-promises/1.1.1/",
"requires_dist": null,
"requires_python": "",
"summary": "(Fork of) Promises/A+ implementation for Python",
"version": "1.1.1"
},
"last_serial": 2578529,
"releases": {
"1.1.0": [
{
"comment_text": "",
"digests": {
"md5": "c7fe5fd1dd0f490d4414d9769d12c53e",
"sha256": "65d18e7b5039874ed000d93dc9de06869ead4e71fad8e87e4df0fb413ebc6886"
},
"downloads": -1,
"filename": "async_promises-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "c7fe5fd1dd0f490d4414d9769d12c53e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7936,
"upload_time": "2017-01-17T01:02:23",
"url": "https://files.pythonhosted.org/packages/a3/87/b31a948c88d3ec877ac816288bf3b1a2e4c4cff1389e8489a5e1126c0117/async_promises-1.1.0.tar.gz"
}
],
"1.1.1": [
{
"comment_text": "",
"digests": {
"md5": "d9fcaa73e87f4faf58ffd6cb9bea4358",
"sha256": "092b1ca2967e8f8bc51029ab831d0066659b5db522b64d6f41c31ac797c4f8da"
},
"downloads": -1,
"filename": "async_promises-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "d9fcaa73e87f4faf58ffd6cb9bea4358",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7925,
"upload_time": "2017-01-17T01:08:07",
"url": "https://files.pythonhosted.org/packages/6e/86/baf2be0b3b9fe28ba1c1ae30176376ec8f828dbfe812b95d37645fd0a5e7/async_promises-1.1.1.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "d9fcaa73e87f4faf58ffd6cb9bea4358",
"sha256": "092b1ca2967e8f8bc51029ab831d0066659b5db522b64d6f41c31ac797c4f8da"
},
"downloads": -1,
"filename": "async_promises-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "d9fcaa73e87f4faf58ffd6cb9bea4358",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7925,
"upload_time": "2017-01-17T01:08:07",
"url": "https://files.pythonhosted.org/packages/6e/86/baf2be0b3b9fe28ba1c1ae30176376ec8f828dbfe812b95d37645fd0a5e7/async_promises-1.1.1.tar.gz"
}
]
}