{ "info": { "author": "Stefan H. Holek", "author_email": "stefan@epy.co.at", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3" ], "description": "====\nlazy\n====\n----------------------------------\nLazy attributes for Python objects\n----------------------------------\n\nPackage Contents\n================\n\n@lazy\n A decorator to create lazy attributes.\n\nOverview\n========\n\n*Lazy attributes* are computed attributes that are evaluated only\nonce, the first time they are used. Subsequent uses return the\nresults of the first call. They come handy when code should run\n\n- *late*, i.e. just before it is needed, and\n- *once*, i.e. not twice, in the lifetime of an object.\n\nYou can think of it as *deferred initialization*.\nThe possibilities are endless.\n\nExamples\n========\n\nThe class below creates its ``store`` resource lazily::\n\n from lazy import lazy\n\n class FileUploadTmpStore(object):\n\n @lazy\n def store(self):\n location = settings.get('fs.filestore')\n return FileSystemStore(location)\n\n def put(self, uid, fp):\n self.store.put(uid, fp)\n fp.seek(0)\n\n def get(self, uid, default=None):\n return self.store.get(uid, default)\n\nAnother application area is caching::\n\n class PersonView(View):\n\n @lazy\n def person_id(self):\n return self.request.get('person_id', -1)\n\n @lazy\n def person_data(self):\n return self.session.query(Person).get(self.person_id)\n\nDocumentation\n=============\n\nFor further details please refer to the `API Documentation`_.\n\n.. _`API Documentation`: https://lazy.readthedocs.io/en/stable/\n\nCredits\n=======\n\nI first encountered this type of descriptor in the\n``zope.cachedescriptors`` package, which is part of the\n`Zope Toolkit`_.\n\n.. _`Zope Toolkit`: https://zopetoolkit.readthedocs.io\n\n\nChangelog\n=========\n\n1.4 - 2019-01-28\n----------------\n\n- Add MANIFEST.in.\n [stefan]\n\n- Release as universal wheel.\n [stefan]\n\n1.3 - 2017-02-05\n----------------\n\n- Support Python 2.6-3.6 without 2to3.\n [stefan]\n\n- Add a LICENSE file.\n [stefan]\n\n1.2 - 2014-04-19\n----------------\n\n- Remove setuptools from install_requires because it isn't.\n [stefan]\n\n1.1 - 2012-10-12\n----------------\n\n- Use ``functools.wraps()`` properly; the list of attributes changes with\n every version of Python 3.\n [stefan]\n\n1.0 - 2011-03-24\n----------------\n\n- Initial release.\n", "description_content_type": "", "docs_url": "https://pythonhosted.org/lazy/", "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stefanholek/lazy", "keywords": "decorator lazy attribute property", "license": "BSD-2-Clause", "maintainer": "", "maintainer_email": "", "name": "lazy", "package_url": "https://pypi.org/project/lazy/", "platform": "", "project_url": "https://pypi.org/project/lazy/", "project_urls": { "Homepage": "https://github.com/stefanholek/lazy" }, "release_url": "https://pypi.org/project/lazy/1.4/", "requires_dist": null, "requires_python": "", "summary": "Lazy attributes for Python objects", "version": "1.4" }, "last_serial": 4751355, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "0e1443afd36216c445e35fa00dd7fb3b", "sha256": "95b13e45ed939708aced3f9e5fc3638ebf62e29064b564d2aca1aa9e463837e6" }, "downloads": -1, "filename": "lazy-1.0.zip", "has_sig": false, "md5_digest": "0e1443afd36216c445e35fa00dd7fb3b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7865, "upload_time": "2011-03-24T10:34:11", "url": "https://files.pythonhosted.org/packages/b3/a1/29eb861301b2ad70b1e6cd20d5e71bf15704749db311843d4a3fed9d65be/lazy-1.0.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "2b9d2aeeec0e3bdc6c073faaaa802d7a", "sha256": "52ed3d79f18ea362cc8f59dd38ac0cafc4b1b9b7f478e0178d31a27a926693d9" }, "downloads": -1, "filename": "lazy-1.1.zip", "has_sig": false, "md5_digest": "2b9d2aeeec0e3bdc6c073faaaa802d7a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14360, "upload_time": "2012-10-12T21:40:31", "url": "https://files.pythonhosted.org/packages/70/23/ea7bebc6e2179730af3da06eeb6216f1f9159ff1712dd36bc937a6a6ecdb/lazy-1.1.zip" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "02713784e0a92ff9b6af1df8863dd79d", "sha256": "127ea610418057b953f0d102bed83f2c367be13b59f8d0ddf3b8a86c7d31b970" }, "downloads": -1, "filename": "lazy-1.2.zip", "has_sig": false, "md5_digest": "02713784e0a92ff9b6af1df8863dd79d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14380, "upload_time": "2014-04-19T19:57:28", "url": "https://files.pythonhosted.org/packages/01/09/45e590953c798349f2b5b2d2c2d669bd2b909e254d75f4f70e55cde8edae/lazy-1.2.zip" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "5582885a0af4890b7baf37e929b434d4", "sha256": "c80a77bf7106ba7b27378759900cfefef38271088dc63b014bcfe610c8e68e3d" }, "downloads": -1, "filename": "lazy-1.3.zip", "has_sig": false, "md5_digest": "5582885a0af4890b7baf37e929b434d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15996, "upload_time": "2017-02-05T13:33:16", "url": "https://files.pythonhosted.org/packages/10/3b/655ffabb1627bff2539ddc3f3e0cdd6df51c65d4d51c20ba4c14e1ee8ad4/lazy-1.3.zip" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "f1b5f89d13e86020f89ea6e2ebe5e849", "sha256": "9f293fd531546f3eda039da8f919b513b94f219e562764e3ceefc26fa503bf03" }, "downloads": -1, "filename": "lazy-1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f1b5f89d13e86020f89ea6e2ebe5e849", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 6239, "upload_time": "2019-01-28T18:32:18", "url": "https://files.pythonhosted.org/packages/b8/06/9e1893ff24ca262950755292015dae2cb32082d19c9432a632747e9f7d43/lazy-1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f4e5a0a5d2add47352a7e10ee87f8211", "sha256": "2c6d27a5ab130fb85435320651a47403adcb37ecbcc501b0c6606391f65f5b43" }, "downloads": -1, "filename": "lazy-1.4.zip", "has_sig": false, "md5_digest": "f4e5a0a5d2add47352a7e10ee87f8211", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10551, "upload_time": "2019-01-28T18:32:15", "url": "https://files.pythonhosted.org/packages/ce/10/2c0cd8a601fff792f814b89233859e3fce2e266a5defd8af3bcadbe5c7ef/lazy-1.4.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f1b5f89d13e86020f89ea6e2ebe5e849", "sha256": "9f293fd531546f3eda039da8f919b513b94f219e562764e3ceefc26fa503bf03" }, "downloads": -1, "filename": "lazy-1.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f1b5f89d13e86020f89ea6e2ebe5e849", "packagetype": "bdist_wheel", "python_version": "3.7", "requires_python": null, "size": 6239, "upload_time": "2019-01-28T18:32:18", "url": "https://files.pythonhosted.org/packages/b8/06/9e1893ff24ca262950755292015dae2cb32082d19c9432a632747e9f7d43/lazy-1.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f4e5a0a5d2add47352a7e10ee87f8211", "sha256": "2c6d27a5ab130fb85435320651a47403adcb37ecbcc501b0c6606391f65f5b43" }, "downloads": -1, "filename": "lazy-1.4.zip", "has_sig": false, "md5_digest": "f4e5a0a5d2add47352a7e10ee87f8211", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10551, "upload_time": "2019-01-28T18:32:15", "url": "https://files.pythonhosted.org/packages/ce/10/2c0cd8a601fff792f814b89233859e3fce2e266a5defd8af3bcadbe5c7ef/lazy-1.4.zip" } ] }