{ "info": { "author": "Cameron Simpson", "author_email": "cs@cskk.id.au", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "*Latest release 20191007*:\nSimplify ResultState definition.\nResult.bg: use cs.threads.bg to dispatch the Thread.\n\nResult and friends.\n\nA Result is the base class for several callable subclasses\nwhich will receive values at a later point in time,\nand can also be used standalone without subclassing.\n\nA call to a Result will block until the value is received or the Result is cancelled,\nwhich will raise an exception in the caller.\nA Result may be called by multiple users, before or after the value has been delivered;\nif the value has been delivered the caller returns with it immediately.\nA Result's state may be inspected (pending, running, ready, cancelled).\nCallbacks can be registered via a Result's .notify method.\n\nAn incomplete Result can be told to call a function to compute its value;\nthe function return will be stored as the value unless the function raises an exception,\nin which case the exception information is recorded instead.\nIf an exception occurred, it will be reraised for any caller of the Result.\n\nTrite example::\n\n R = Result(name=\"my demo\")\n\n Thread 1:\n value = R()\n # blocks...\n print(value)\n # prints 3 once Thread 2 (below) assigns to it\n\n Thread 2:\n R.result = 3\n\n Thread 3:\n value = R()\n # returns immediately with 3\n\nYou can also collect multiple Results in completion order using the report() function::\n\n Rs = [ ... list of Results of whatever type ... ]\n ...\n for R in report(Rs):\n x = R() # collect result, will return immediately because\n # the Result is complete\n print(x) # print result\n\n## Function `after(Rs, R, func, *a, **kw)`\n\nAfter the completion of `Rs` call `func(*a,**kw)` and return\nits result via `R`; return the `Result` object.\n\nParameters:\n* `Rs`: an iterable of Results.\n* `R`: a `Result` to collect to result of calling `func`.\n If `None`, one will be created.\n* `func`, `a`, `kw`: a callable and its arguments.\n\n## Class `AsynchState`\n\nMRO: `enum.Enum` \nState tokens for `Result`s.\n\n## Function `bg(func, *a, **kw)`\n\nDispatch a `Thread` to run `func`, return a `Result` to collect its value.\n\n## Class `CancellationError`\n\nMRO: `builtins.Exception`, `builtins.BaseException` \nRaised when accessing result or exc_info after cancellation.\n\n## Class `OnDemandFunction`\n\nMRO: `Result` \nWrap a callable, run it when required.\n\n## Class `OnDemandResult`\n\nMRO: `Result` \nWrap a callable, run it when required.\n\n## Function `report(LFs)`\n\nGenerator which yields completed `Result`s.\n\nThis is a generator that yields `Result`s as they complete,\nuseful for waiting for a sequence of `Result`s\nthat may complete in an arbitrary order.\n\n## Class `Result`\n\nBasic class for asynchronous collection of a result.\nThis is also used to make OnDemandFunctions, LateFunctions and other\nobjects with asynchronous termination.\n\n### Method `Result.__init__(self, name=None, lock=None, result=None)`\n\nBase initialiser for `Result` objects and subclasses.\n\nParameter:\n* `name`: optional parameter naming this object.\n* `lock`: optional locking object, defaults to a new `threading.Lock`.\n* `result`: if not `None`, prefill the `.result` property.\n\n## Class `ResultState`\n\nMRO: `enum.Enum` \nState tokens for `Result`s.\n\n\n\n# Release Log\n\n*Release 20191007*:\nSimplify ResultState definition.\nResult.bg: use cs.threads.bg to dispatch the Thread.\n\n*Release 20190522*:\nResult.__call__ now accepts an optional callable and args.\nResult.call: set the Result state to \"running\" before dispatching the function.\nRename OnDemandFunction to OnDemandResult, keep old name around for compatibility.\nResult._complete: also permitted if state==cancelled.\n\n*Release 20190309*:\nSmall bugfix.\n\n*Release 20181231*:\nResult.call: report baser exceptions than BaseException.\nDrop _PendingFunction abstract class.\n\n*Release 20181109.1*:\nDISTINFO update.\n\n*Release 20181109*:\nDerive CancellationError from Exception instead of RuntimeError, fix initialiser.\nRename AsynchState to ResultState and make it an Enum.\nMake Results hashable and comparable for equality for use as mapping keys: equality is identity.\nNew Result.collected attribute, set true if .result or .exc_info are accessed, logs an error if Result.__del__ is called when false, may be set true externally if a Result is not required.\nDrop `final` parameter; never used and supplanted by Result.notify.\nResult.join: return the .result and .exc_info properties in order to mark the Result as collected.\nResult: set .collected to True when a notifier has been called successfully.\nBugfix Result.cancel: apply the new cancelled state.\n\n*Release 20171231*:\nBugfix Result.call to catch BaseException instead of Exception.\nNew convenience function bg(func) to dispatch `func` in a separate Thread and return a Result to collect its value.\n\n*Release 20171030.1*:\nFix module requirements specification.\n\n*Release 20171030*:\nNew Result.bg(func, *a, **kw) method to dispatch function in separate Thread to compute the Result value.\n\n*Release 20170903*:\nrename cs.asynchron to cs.result", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/cameron_simpson/css/commits/all", "keywords": "python2,python3", "license": "GNU General Public License v3 or later (GPLv3+)", "maintainer": "", "maintainer_email": "", "name": "cs.result", "package_url": "https://pypi.org/project/cs.result/", "platform": "", "project_url": "https://pypi.org/project/cs.result/", "project_urls": { "Homepage": "https://bitbucket.org/cameron_simpson/css/commits/all" }, "release_url": "https://pypi.org/project/cs.result/20191007/", "requires_dist": null, "requires_python": "", "summary": "Result and friends: callable objects which will receive a value at a later point in time.", "version": "20191007" }, "last_serial": 5936668, "releases": { "20171030": [ { "comment_text": "", "digests": { "md5": "3d432b993bb7ef6e0eba66e1c283cf1f", "sha256": "31fc41acf11cec8ada130ff29a6536887e9e1de2fd75adaf41fe7e1a0da88231" }, "downloads": -1, "filename": "cs.result-20171030.tar.gz", "has_sig": false, "md5_digest": "3d432b993bb7ef6e0eba66e1c283cf1f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5658, "upload_time": "2017-10-30T10:26:56", "url": "https://files.pythonhosted.org/packages/b1/a5/e1dc8526b34e1acf93d3ef297a2d337e43ae82cfca9fe3de1386dac702da/cs.result-20171030.tar.gz" } ], "20171030.1": [ { "comment_text": "", "digests": { "md5": "dd92ad3f8316858f823f52f23ec35eb6", "sha256": "0534ffdd0176e43ac4b1995f4c0cc030e7f3842fbc4cee58a4c1834db932ca2b" }, "downloads": -1, "filename": "cs.result-20171030.1.tar.gz", "has_sig": false, "md5_digest": "dd92ad3f8316858f823f52f23ec35eb6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5654, "upload_time": "2017-10-30T10:30:33", "url": "https://files.pythonhosted.org/packages/a2/58/1c40b0e597590cc73de2db7ac16a567aca62f6e8d6064018d0f991b34d5a/cs.result-20171030.1.tar.gz" } ], "20171231": [ { "comment_text": "", "digests": { "md5": "5e096eb403cd94fec94ac8a38f8ba6f5", "sha256": "75e1eb8f47cf4de8439c6cb626963644348208133b871b264904047759f91b3c" }, "downloads": -1, "filename": "cs.result-20171231.tar.gz", "has_sig": false, "md5_digest": "5e096eb403cd94fec94ac8a38f8ba6f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5832, "upload_time": "2017-12-30T21:59:01", "url": "https://files.pythonhosted.org/packages/ff/bb/6aa5f415d427c4039d2c3901ae04152d4f24f387c0701fcb5fe958dc2773/cs.result-20171231.tar.gz" } ], "20181109.1": [ { "comment_text": "", "digests": { "md5": "95f5de5981b249ed55f74632a5ee774a", "sha256": "cc763dc2e71933c220480d73f8dc83516d8667d94577ec90b2ae8a03bce22691" }, "downloads": -1, "filename": "cs.result-20181109.1.tar.gz", "has_sig": false, "md5_digest": "95f5de5981b249ed55f74632a5ee774a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6291, "upload_time": "2018-11-09T01:33:58", "url": "https://files.pythonhosted.org/packages/e2/80/2de61a9b19a4929a9eacfb8074bb826206f70a6d9d81c0acb9b52448686f/cs.result-20181109.1.tar.gz" } ], "20181231": [ { "comment_text": "", "digests": { "md5": "3c7019dfe545f2a81a1a3284d66c422c", "sha256": "2a9acacc17787a6811179094efd3cb502cdd321002a24e9ac30d2a15ab282010" }, "downloads": -1, "filename": "cs.result-20181231.tar.gz", "has_sig": false, "md5_digest": "3c7019dfe545f2a81a1a3284d66c422c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6232, "upload_time": "2018-12-31T10:29:35", "url": "https://files.pythonhosted.org/packages/3c/89/7a0c33995833a715f8bc34bc12a65da6a956386672538e074b1736db572e/cs.result-20181231.tar.gz" } ], "20190309": [ { "comment_text": "", "digests": { "md5": "7a2f26482c8d181249039e937d1c2c29", "sha256": "81c8a00750ceef550f7a7202f08b4041bfc0efe6404cbf46adaa79415efbb058" }, "downloads": -1, "filename": "cs.result-20190309.tar.gz", "has_sig": false, "md5_digest": "7a2f26482c8d181249039e937d1c2c29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6462, "upload_time": "2019-03-09T04:26:28", "url": "https://files.pythonhosted.org/packages/fe/14/219a34300f6edd8bc56b61ef4cf19b8882ad71a12dfcd6b198e69fea6acb/cs.result-20190309.tar.gz" } ], "20190522": [ { "comment_text": "", "digests": { "md5": "7955887145d8afa1f8f737bea100b273", "sha256": "8a83e0bc8412799c659849535ecceb24d0bcb7c682ff38d5275199bb262605d8" }, "downloads": -1, "filename": "cs.result-20190522.tar.gz", "has_sig": false, "md5_digest": "7955887145d8afa1f8f737bea100b273", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6593, "upload_time": "2019-05-22T02:42:18", "url": "https://files.pythonhosted.org/packages/85/05/d93be8d0446ecf36ac1cdb29724a08f769d0b68c29a9d172a9d8f8421d6f/cs.result-20190522.tar.gz" } ], "20191007": [ { "comment_text": "", "digests": { "md5": "beeb0ca8836f9d4cd5b327c10a2dc450", "sha256": "7f9d6205af18470686c6adfdd1c6190a97d0bd04d1e9ba847384d2892b3e732d" }, "downloads": -1, "filename": "cs.result-20191007.tar.gz", "has_sig": false, "md5_digest": "beeb0ca8836f9d4cd5b327c10a2dc450", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7730, "upload_time": "2019-10-07T02:47:11", "url": "https://files.pythonhosted.org/packages/b6/46/43c6fb7f21337860b952084fa8783b159a68cd7f6bd036b2f434a0801c1f/cs.result-20191007.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "beeb0ca8836f9d4cd5b327c10a2dc450", "sha256": "7f9d6205af18470686c6adfdd1c6190a97d0bd04d1e9ba847384d2892b3e732d" }, "downloads": -1, "filename": "cs.result-20191007.tar.gz", "has_sig": false, "md5_digest": "beeb0ca8836f9d4cd5b327c10a2dc450", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7730, "upload_time": "2019-10-07T02:47:11", "url": "https://files.pythonhosted.org/packages/b6/46/43c6fb7f21337860b952084fa8783b159a68cd7f6bd036b2f434a0801c1f/cs.result-20191007.tar.gz" } ] }