{ "info": { "author": "Ivan Alejandro", "author_email": "ivanalejandro0@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7" ], "description": "RequireType\n===========\n\nWhat\n----\n\nDecorator that allows you to specify the valid types of the parameters in a\nfunction or method.\n\nIn case of that a call don't match the required type will fail with a\n``TypeError`` exception.\n\n\nWhy?\n----\n\nThere are some cases (TODO: add some examples) where you want/need to specify a\nspecific type to use and since python does not have type checks for parameters\nhere's where this is useful.\n\nAll the existing solutions that I've found had some problem or does not have a\nfeature that I'd like to have, so I've made my own.\n\n\nHow to use?\n-----------\n\nFirst, install the ``RequireType`` package, you can do that using ``pip``::\n pip install requiretype\n\nIn your code you just need to import and use the ``require`` decorator.\n\nExample::\n\n from requiretype import require\n\n @require(name=str, age=(int, float, long))\n def greet_person(name, age):\n print \"Hello {0} ({1})\".format(name, age)\n\n >>> greet_person(\"John\", 42)\n Hello John (42)\n\n >>> greet_person(\"John\", \"Doe\")\n [...traceback...]\n TypeError: Doe is not a valid type.\n Valid types: , , \n\n >>> greet_person(42, 43)\n [...traceback...]\n TypeError: 42 is not a type\n\n\n\n\nSome notes\n----------\n\nHere are some details about this library. Most of them was found in one or\nmore packages that helps you to enforce/check/require types and IMO are not\ngood things to have and motivated me to write this.\n\nRequireType:\n\n * does not modify ``args`` or ``kwargs``\n * does not move arguments from one place to another\n * support both ``args`` and ``kwargs``\n * allows you to use all the python 2.x supported parameters usage (if not, please report a bug)\n * use named arguments type definition\n * allows you to enforce a subset of all the available arguments\n * raise a standard ``TypeError`` if the arguments type are wrong", "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/ivanalejandro0/RequireType", "keywords": "requiretype", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "RequireType", "package_url": "https://pypi.org/project/RequireType/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/RequireType/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ivanalejandro0/RequireType" }, "release_url": "https://pypi.org/project/RequireType/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Decorator that allows you to specify the valid types of the parameters in a function or method.", "version": "0.1.0" }, "last_serial": 1741348, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0cd0a113f19b2292d324fa9e3fa4ac2d", "sha256": "bbdc27f8439fc667c31ce105aa472c61d707b75858ef968d88aef1ec51e456d3" }, "downloads": -1, "filename": "RequireType-0.1.0.tar.gz", "has_sig": false, "md5_digest": "0cd0a113f19b2292d324fa9e3fa4ac2d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3445, "upload_time": "2015-09-28T04:06:50", "url": "https://files.pythonhosted.org/packages/2d/f1/d0cdddfac81c796dda82a7c76e2e89360678de6bb7ea03a7807eacb5f564/RequireType-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0cd0a113f19b2292d324fa9e3fa4ac2d", "sha256": "bbdc27f8439fc667c31ce105aa472c61d707b75858ef968d88aef1ec51e456d3" }, "downloads": -1, "filename": "RequireType-0.1.0.tar.gz", "has_sig": false, "md5_digest": "0cd0a113f19b2292d324fa9e3fa4ac2d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3445, "upload_time": "2015-09-28T04:06:50", "url": "https://files.pythonhosted.org/packages/2d/f1/d0cdddfac81c796dda82a7c76e2e89360678de6bb7ea03a7807eacb5f564/RequireType-0.1.0.tar.gz" } ] }