{ "info": { "author": "Bagrat Aznauryan", "author_email": "bagrat@aznauryan.org", "bugtrack_url": null, "classifiers": [], "description": "mutexinit\n=========\n\nThis package provides a *metaclass* and a *decorator* to enable mutually exclusive constructors for Python classes.\n\nAll you need to do is just make a class with the ``MutexInitMeta`` metaclass and declare each mutually exclusive constructor as a \ninstance method, and also decorate it with ``@subinit`` decorator.\n\nHere is a simple example::\n\n from mutexinit import MutexInitMeta, subinit\n \n class MyClass(object):\n __metaclass__ = MutexInitMeta\n\n @subinit\n def foo(self, bar, baz):\n print('Running \"foo\" constructor')\n \n @subinit\n def bar(self, foo, baz):\n print('Running \"bar\" constructor')\n \nThis is all to make a class to have mutually exclusive constructors. After defining the class, go ahead, and initialise it::\n \n >>> my_instance1 = MyClass(bar=1, baz=2)\n Running \"foo\" constructor\n >>> my_instance2 = MyClass(foo=9, baz=8)\n Running \"bar\" constructor\n >>> my_instance2 = MyClass(foo=None, baz=8)\n AttributeError: Mutex init arguments cannot be None\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "mutexinit", "package_url": "https://pypi.org/project/mutexinit/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/mutexinit/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/mutexinit/0.0/", "requires_dist": null, "requires_python": null, "summary": "UNKNOWN", "version": "0.0" }, "last_serial": 1702080, "releases": { "0.0": [ { "comment_text": "", "digests": { "md5": "d79699c469bd8595ec39641587de5b94", "sha256": "b39d84caae2f31355b75833d60cef8c621f459b8a7e021a3ec393c37aa4167fd" }, "downloads": -1, "filename": "mutexinit-0.0.tar.gz", "has_sig": false, "md5_digest": "d79699c469bd8595ec39641587de5b94", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1254, "upload_time": "2015-08-31T19:23:03", "url": "https://files.pythonhosted.org/packages/29/15/2fda4f4290f28efc3fc13909edb4dc07a5d82f228432bc197fd7948b5b8d/mutexinit-0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d79699c469bd8595ec39641587de5b94", "sha256": "b39d84caae2f31355b75833d60cef8c621f459b8a7e021a3ec393c37aa4167fd" }, "downloads": -1, "filename": "mutexinit-0.0.tar.gz", "has_sig": false, "md5_digest": "d79699c469bd8595ec39641587de5b94", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1254, "upload_time": "2015-08-31T19:23:03", "url": "https://files.pythonhosted.org/packages/29/15/2fda4f4290f28efc3fc13909edb4dc07a5d82f228432bc197fd7948b5b8d/mutexinit-0.0.tar.gz" } ] }