{ "info": { "author": "Brad Greenlee", "author_email": "brad@footle.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: POSIX :: Linux", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "virtualmethod\n=============\n\nDecorator to prevent base class methods from being called directly.\n\nUsage\n-----\n\n::\n\n from virtualmethod import virtualmethod\n\n class Base(object):\n @virtualmethod\n def my_virtual_method(self):\n print \"This is a virtual method. Call me from a subclass!\"\n\n class A(Base):\n pass\n\n class B(Base):\n def my_virtual_method(self):\n print \"I went ahead and implemented my own version.\"\n\n base = Base()\n a = A()\n b = B()\n\n a.my_virtual_method()\n -> This is a virtual method. Call me from a subclass!\n\n b.my_virtual_method()\n -> I went ahead and implemented my own version.\n\n base.my_virtual_method()\n -> Traceback (most recent call last):\n File \"\", line 1, in \n File \"virtualmethod/core.py\", line 11, in __call__\n raise TypeError(\"Virtual method %s must be called from a subclass.\" % self.__name__)\n TypeError: Virtual method my_virtual_method must be called from a subclass.\n\nNote(s)\n-------\n\n``@virtualmethod`` works with ``@classmethod`` and ``@staticmethod``,\nbut must be declared first, i.e.:\n\n::\n\n @virtualmethod\n @classmethod\n def my_virtual_class_method(cls):\n ...\n\nCredit\n------\n\nThanks to `Patrick Hensley `_ for his input,\nand to `Denis Ryzhkov `_ for his\n``method_decorator`` module.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/bgreenlee/virtualmethod", "keywords": "decorator,virtual method", "license": "Apache 2.0", "maintainer": null, "maintainer_email": null, "name": "virtualmethod", "package_url": "https://pypi.org/project/virtualmethod/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/virtualmethod/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/bgreenlee/virtualmethod" }, "release_url": "https://pypi.org/project/virtualmethod/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "Decorator to prevent base class methods from being called directly.", "version": "0.0.1" }, "last_serial": 749195, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "ee70c31128e67bedfce2698c355b4ee4", "sha256": "4735ca7ee36b7b858ee5c71fd53123e599375db1f11eb16f60adcc5ce55feac2" }, "downloads": -1, "filename": "virtualmethod-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ee70c31128e67bedfce2698c355b4ee4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3474, "upload_time": "2011-07-14T19:41:52", "url": "https://files.pythonhosted.org/packages/96/da/b1e61548b584947445311290de9b45604dc7ef0374cc148b276501b3d7e5/virtualmethod-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ee70c31128e67bedfce2698c355b4ee4", "sha256": "4735ca7ee36b7b858ee5c71fd53123e599375db1f11eb16f60adcc5ce55feac2" }, "downloads": -1, "filename": "virtualmethod-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ee70c31128e67bedfce2698c355b4ee4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3474, "upload_time": "2011-07-14T19:41:52", "url": "https://files.pythonhosted.org/packages/96/da/b1e61548b584947445311290de9b45604dc7ef0374cc148b276501b3d7e5/virtualmethod-0.0.1.tar.gz" } ] }