{ "info": { "author": "Infrae", "author_email": "info@infrae.com", "bugtrack_url": null, "classifiers": [ "Framework :: Zope2", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "================\ninfrae.comethods\n================\n\nThis package provides an helper to write cofunction with the help of\nPython generators. It provides a decorator that let you write the\nfollowing paradigm::\n\n from infrae.comethod import cofunction\n\n @cofunction\n def processor(**options):\n # Init code\n content = yield\n while content is not None:\n # Work on content, set result in result.\n content = yield result\n # Cleanup code\n\n\nIf you create more of those comethods you can nest them::\n\n import logging\n\n @cofunction\n def logger(parent **options):\n logger = logging.getLogger(options.get('name', 'default'))\n logger.info('Start')\n content = yield\n while content is not None:\n result = parent(content)\n logger.info('Processed {0}, got {1}'.format(content, result))\n content = yield result\n # Cleanup code\n logger.info('Done')\n\n\nAnd you can use it like this::\n\n with processor() as process:\n with logger(process) as log:\n for item in generator():\n log(item)\n\nOr alternatively::\n\n with processor() as process:\n with logger(process) as log:\n log.map(generator)\n\n\nWhere generator is a generator that yield values to work on. Of\ncourse, you can do more interesting things after.\n\nYou can find the Mercurial code repository at:\nhttps://hg.infrae.com/infrae.comethods/\n\nChanges\n=======\n\n1.0 (2011/11/07)\n----------------\n\n* Initial version.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://infrae.com/products/silva", "keywords": "comethod generator context manager", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "infrae.comethods", "package_url": "https://pypi.org/project/infrae.comethods/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/infrae.comethods/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://infrae.com/products/silva" }, "release_url": "https://pypi.org/project/infrae.comethods/1.0/", "requires_dist": null, "requires_python": null, "summary": "Sugar around Python generators and context managers", "version": "1.0" }, "last_serial": 945356, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "1ce202c65398f075bf34af7f0dc49c52", "sha256": "5af45fb239f9944357e302485f20045d06f0ace194587e57d2e06e68f1076f56" }, "downloads": -1, "filename": "infrae.comethods-1.0.tar.gz", "has_sig": false, "md5_digest": "1ce202c65398f075bf34af7f0dc49c52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2704, "upload_time": "2011-11-07T17:17:58", "url": "https://files.pythonhosted.org/packages/d1/ea/fdbcb466d95264c507c13258c992e7850fd4b7ea8473b877cdd5b3b5dcce/infrae.comethods-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1ce202c65398f075bf34af7f0dc49c52", "sha256": "5af45fb239f9944357e302485f20045d06f0ace194587e57d2e06e68f1076f56" }, "downloads": -1, "filename": "infrae.comethods-1.0.tar.gz", "has_sig": false, "md5_digest": "1ce202c65398f075bf34af7f0dc49c52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2704, "upload_time": "2011-11-07T17:17:58", "url": "https://files.pythonhosted.org/packages/d1/ea/fdbcb466d95264c507c13258c992e7850fd4b7ea8473b877cdd5b3b5dcce/infrae.comethods-1.0.tar.gz" } ] }