{ "info": { "author": "Daniel Neuh\u00e4user", "author_email": "ich@danielneuhaeuser.de", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: Implementation :: CPython" ], "description": "Hybrid-Attributes\n=================\n\n.. image:: https://travis-ci.org/DasIch/hybrid-attributes.svg?branch=master\n :target: https://travis-ci.org/DasIch/hybrid-attributes\n :alt: Travis CI Status\n\n.. image:: https://codecov.io/gh/DasIch/hybrid-attributes/coverage.svg\n :target: https://codecov.io/gh/DasIch/hybrid-attributes\n :alt: Codecov Status\n\n.. image:: https://readthedocs.org/projects/hybrid-attributes/badge/?version=latest\n :target: http://hybrid-attributes.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation\n\nHybrid-Attributes implements a `hybrid_property` and `hybrid_method`\ndescriptor, which call the underlying function both in a class and instance\ncontext.\n\nAssume you have a class like::\n\n class Foo:\n @classmethod\n def spam(self):\n return 'spam'\n\n @property\n def eggs(self):\n return 'eggs'\n\n def ham(self):\n return 'ham'\n\nYou can get the values returned by calling `.spam()` on the class, accessing\n'.eggs' or calling `.ham()` on an instance:\n\n>>> Foo.spam()\n'spam'\n>>> foo = Foo()\n>>> foo.eggs\n'eggs'\n>>> foo.ham()\n'ham'\n\nIf you access these in a different context, `.spam()` will still be\ncalled with the class as first argument, `.eggs` will return a property object\nonly useful for introspection and `.ham()` will raise an exception because\nthere is no instance for it to be called with.\n\nHybrid-Attributes are different. They don't care about the object are accessed\nthrough, the underlying function will always be called with whatever object\nit's being accessed on. As an example, take this class::\n\n class HybridFoo:\n @hybrid_property\n def spam(self):\n return 'spam'\n\n @hybrid_method\n def eggs(self):\n return 'eggs'\n\nYou can access the property and call the method on the class or on an instance:\n\n>>> Foo.spam\n'spam'\n>>> Foo.eggs()\n'eggs'\n>>> foo = Foo()\n>>> foo.spam\n'spam'\n>>> foo.eggs\n\nHybrid-Attributes is BSD licensed and available for Python 3.4 and later.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/DasIch/hybrid-attributes/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "hybrid-attributes", "package_url": "https://pypi.org/project/hybrid-attributes/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/hybrid-attributes/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/DasIch/hybrid-attributes/" }, "release_url": "https://pypi.org/project/hybrid-attributes/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Hybrid attributes", "version": "0.1.0" }, "last_serial": 2226397, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0609d83fd184698921501a3c91bd0059", "sha256": "86690cfbb9546fbd3a51268ee66ab1d7888d7d6db3c88bf6a5c5ebf3c71ddd49" }, "downloads": -1, "filename": "hybrid_attributes-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0609d83fd184698921501a3c91bd0059", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 5030, "upload_time": "2016-07-17T00:02:05", "url": "https://files.pythonhosted.org/packages/90/38/8a08a1252eeb58a8d9b9d32a9ee6f4b22ac64dcf9613fa87547f5c338eb1/hybrid_attributes-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7b1bde0698b73699eb9c755dd03615fe", "sha256": "225d359527abd504de2481e2326fb1b5dab8ac1a371488197efbc4c4c3516a9e" }, "downloads": -1, "filename": "hybrid-attributes-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7b1bde0698b73699eb9c755dd03615fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11742, "upload_time": "2016-07-17T00:02:14", "url": "https://files.pythonhosted.org/packages/db/40/5fdc85654f40abd47222129b84e987166d3c97ee39f24cbb379adc758b29/hybrid-attributes-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0609d83fd184698921501a3c91bd0059", "sha256": "86690cfbb9546fbd3a51268ee66ab1d7888d7d6db3c88bf6a5c5ebf3c71ddd49" }, "downloads": -1, "filename": "hybrid_attributes-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0609d83fd184698921501a3c91bd0059", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 5030, "upload_time": "2016-07-17T00:02:05", "url": "https://files.pythonhosted.org/packages/90/38/8a08a1252eeb58a8d9b9d32a9ee6f4b22ac64dcf9613fa87547f5c338eb1/hybrid_attributes-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7b1bde0698b73699eb9c755dd03615fe", "sha256": "225d359527abd504de2481e2326fb1b5dab8ac1a371488197efbc4c4c3516a9e" }, "downloads": -1, "filename": "hybrid-attributes-0.1.0.tar.gz", "has_sig": false, "md5_digest": "7b1bde0698b73699eb9c755dd03615fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11742, "upload_time": "2016-07-17T00:02:14", "url": "https://files.pythonhosted.org/packages/db/40/5fdc85654f40abd47222129b84e987166d3c97ee39f24cbb379adc758b29/hybrid-attributes-0.1.0.tar.gz" } ] }