{ "info": { "author": "Matthew Wo", "author_email": "9029537@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "initify.py\n==========\n\nThe missing magical python decorator for simplifying your ``__init__(self, ...)`` function.\n\n.. code:: python\n\n @init_args # Magical decorator\n def __init__(self, name=\"Lovely Lucy\", age=10):\n pass\n\n p = Person()\n p.name # \"Lovely Lucy\"\n p.age # 10 **Sweet**!\n\nInherited variables from super class\n------------------------------------\n\nIf you have polymorphism structured classes, you'd love initify.\n\n.. code:: python\n\n class Animal(object):\n def __init__(self):\n self.age = 0\n self.name = \"\"\n self.color = \"\"\n ...\n\n class Dog(Animal):\n @init_args\n def __init__(self, pet=True):\n pass\n ...\n\n class Cat(Animal):\n @init_args\n def __init__(self, wild=False):\n pass\n ...\n\n.. code:: python\n\n d = Dog(age=3, name=\"Golfy\", color=\"black\")\n d.age # 3\n d.name # Golfy\n d.color # black\n d.pet # True\n\n c = Cat()\n c.age # 0\n c.name # \"\"\n c.color # \"\"\n c.wild # False\n\n--------------\n\nThat's dull :/ Don't judge until you see this:\n\nExclused variables\n------------------\n\n.. code:: python\n\n # Must declare with new-style class in python 2.7 or earlier\n # ``class Animal:`` is fine if using python 3 or later\n class Animal(object):\n def __init__(self):\n self.age = 0\n self.name = \"\"\n self.color = \"\"\n ...\n self.barks = True # Only dog barks\n self.meows = True # and only cat meows\n ...\n\n class Dog(Animal):\n @init_args(exclude=['meows']) # Don't inherit meows from super class!\n def __init__(self, pet=True):\n pass\n ...\n\n class Cat(Animal):\n @init_args(exclude=['barks']) # Don't inherit barks from super class!\n def __init__(self, wild=False):\n pass\n ...\n\n.. code:: python\n\n d = Dog(age=3, name=\"Golfy\", color=\"black\")\n d.age # 3\n d.name # Golfy\n d.color # black\n d.pet # True\n ...\n d.barks # True\n d.meows # Attribute Error: meows is not defined!\n\n c = Cat()\n c.age # 0\n c.name # \"\"\n c.color # \"\"\n c.wild # False\n ...\n d.meows # True\n d.barks # Attribute Error: barks is not defined!\n\nNow this is neat hey?\n\nInstallation\n------------\n\nInstall ``initify`` with pip or pip3.\n\n.. code:: bash\n\n pip install initify\n\n.. code:: bash\n\n pip3 install initify\n\nThen whichever class you're using initify, do an import before using.\nExample:\n\n.. code:: python\n\n from initify import init_args\n\nNow you can attach the decorator ``@init_args`` right before the class's\ninitializer ``def ___init___(self, ...)``. Enjoy your effort.\n\nSupport\n-------\n\nHope this decorator can help you with your \\`\\ ``DRY``-iness in your\npython project!\n\nIf you have any suggestion, please don't hesistate to give a post on the\nissue page.\n\nCheers and happy hacking!\n", "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/prankymat/initify.py", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "initify", "package_url": "https://pypi.org/project/initify/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/initify/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/prankymat/initify.py" }, "release_url": "https://pypi.org/project/initify/0.1.5/", "requires_dist": null, "requires_python": null, "summary": "Simplify your __init__(self) function.", "version": "0.1.5" }, "last_serial": 2734059, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "4c37600a5eaac9768683c96eb65114b9", "sha256": "d824d10fb0f4dd0acb62424b0fb6350584252525c4dbab87719822ba100c9dea" }, "downloads": -1, "filename": "initify-0.1.3-py2-none-any.whl", "has_sig": false, "md5_digest": "4c37600a5eaac9768683c96eb65114b9", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2356, "upload_time": "2017-03-27T05:18:10", "url": "https://files.pythonhosted.org/packages/42/b1/771c2058e0bdf5d3c066027fedf080bc6a9410a1cddbd82b1d22da1a387b/initify-0.1.3-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "64ea8266f8cae2d750bd412ca08d68c8", "sha256": "dc0fe63e614582084cbdb70e6ab6b0dbfd8d34fd38dcecdc1ecb15f4238cd375" }, "downloads": -1, "filename": "initify-0.1.3.tar.gz", "has_sig": false, "md5_digest": "64ea8266f8cae2d750bd412ca08d68c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2144, "upload_time": "2017-03-27T05:18:08", "url": "https://files.pythonhosted.org/packages/c1/47/199a87076c5c1743c84c11f529c548e23e986db4b1c02776a4cc15292218/initify-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "2775358981a3fa95d3af20e5c371d06e", "sha256": "696da75e363abfd66ece3b95726fe6e20e88ac4fbf2289836b3c71ca702be001" }, "downloads": -1, "filename": "initify-0.1.4-py2-none-any.whl", "has_sig": false, "md5_digest": "2775358981a3fa95d3af20e5c371d06e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2358, "upload_time": "2017-03-27T07:38:25", "url": "https://files.pythonhosted.org/packages/83/3e/41d8fd44a6877453fb38bb113f37a3a4ece356cf86dd108221fc6b822db6/initify-0.1.4-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3a28b227ca08735344f5865f7ac1a5fe", "sha256": "38c9076b7a06763ce1a4968c38126394736ebabc08eff78cea14c9585bed70f5" }, "downloads": -1, "filename": "initify-0.1.4.tar.gz", "has_sig": false, "md5_digest": "3a28b227ca08735344f5865f7ac1a5fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2214, "upload_time": "2017-03-27T07:38:23", "url": "https://files.pythonhosted.org/packages/7e/9c/5e8927b8284d57ba5c3bd83d6e83ca4fa26b058ded6496acedd5cb9e76b3/initify-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "835c99b6525043b9382ed2185c545e7e", "sha256": "e02a7df14d76c9fd64f6381b45aa0ca8bb26c3fd1e2949c0ac0eac9cbcd7f3fd" }, "downloads": -1, "filename": "initify-0.1.5-py2-none-any.whl", "has_sig": false, "md5_digest": "835c99b6525043b9382ed2185c545e7e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2360, "upload_time": "2017-03-27T17:29:57", "url": "https://files.pythonhosted.org/packages/94/f9/292e1c7292f57b43df688c0108fbebc948c75c23bb505880ff906c796fe0/initify-0.1.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "62d5738cdf1254bced392a4a991349f2", "sha256": "566216661f3becf1675b5bcede6ce33365543b6e75efa56bff652a8bf5dc026d" }, "downloads": -1, "filename": "initify-0.1.5.tar.gz", "has_sig": false, "md5_digest": "62d5738cdf1254bced392a4a991349f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2188, "upload_time": "2017-03-27T17:29:56", "url": "https://files.pythonhosted.org/packages/a4/ec/09c61fbc9e19e61f0962909baaa64a7683216402465b39f38c57c7d25bb5/initify-0.1.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "835c99b6525043b9382ed2185c545e7e", "sha256": "e02a7df14d76c9fd64f6381b45aa0ca8bb26c3fd1e2949c0ac0eac9cbcd7f3fd" }, "downloads": -1, "filename": "initify-0.1.5-py2-none-any.whl", "has_sig": false, "md5_digest": "835c99b6525043b9382ed2185c545e7e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2360, "upload_time": "2017-03-27T17:29:57", "url": "https://files.pythonhosted.org/packages/94/f9/292e1c7292f57b43df688c0108fbebc948c75c23bb505880ff906c796fe0/initify-0.1.5-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "62d5738cdf1254bced392a4a991349f2", "sha256": "566216661f3becf1675b5bcede6ce33365543b6e75efa56bff652a8bf5dc026d" }, "downloads": -1, "filename": "initify-0.1.5.tar.gz", "has_sig": false, "md5_digest": "62d5738cdf1254bced392a4a991349f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2188, "upload_time": "2017-03-27T17:29:56", "url": "https://files.pythonhosted.org/packages/a4/ec/09c61fbc9e19e61f0962909baaa64a7683216402465b39f38c57c7d25bb5/initify-0.1.5.tar.gz" } ] }