{ "info": { "author": "Taylor Marks", "author_email": "taylor@marksfam.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.3", "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.1", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "typeargs\n=========\n*Smarter positional argument handling*\n\nInstallation\n------------\nInstall via pip:\n\n.. code-block:: bash\n\n $ pip install typeargs\n\nDone.\n\nIf you insist on the (slightly) harder way of installing, from source,\nyou know how to do it already and don't need my help.\n\nI might later upload the source to:\nhttps://github.com/TaylorSMarks/typeargs\n\nDocumentation\n-------------\nWhen you call an ordinary Python function, it blindly passes in your positional arguments, and then it passes in your keyword arguments.\n\nSuppose you had a function with a signature like this, as is the case for many things in Tkinter:\n\n.. code-block:: python\n\n def makeWidget(master = None, contents = '', x = 0, y = 0, xSpan = 1, ySpan = 1):\n\nYou want to call this function now, without specifying a master. Here are your options normally:\n\n.. code-block:: python\n\n makeWidget(None, 'This is impossible to read.', 5, 7, 2, 2)\n\nQuick! Without looking at the signature, what the heck are those numbers at the end? Normally you solve it with this:\n\n.. code-block:: python\n\n makeWidget(s = 'Better, but so much typing...', x = 5, y = 7, xSpan = 2, ySpan = 2)\n\nNow that you include all the names, it's easier to tell what each argument is, but its so verbose... it's kind of heavy.\n\nThis is where typeargs comes in. If you go back to the original function and decorate it with typeargs as such:\n\n.. code-block:: python\n\n @typeargs (Master, str, int, int, int, int)\n def makeWidget(master = None, s = '', x = 0, y = 0, xSpan = 1, ySpan = 1):\n\nNow a caller can just type this:\n\n.. code-block:: python\n\n makeWidget('Hello World!', 2, 2, x = 5, y = 7)\n\nOkay now, what's what? Obviously our string is Hello World!, x is 5, y is 7, and we have two more arguments of ints. Those must be xSpan and ySpan, and no master was included, so it'll use the default None.\n\nBy intelligently handling positional arguments based on their types, you can skip over arguments you want default values for, without using key-word arguments for every name.\n\nAnother example - lets say that you want to pass in master at the end:\n\n.. code-block:: python\n\n makeWidget('Hello World!', 2, 2, x = 5, y = 7, master = Master('Window'))\n makeWidget('Hello World!', 2, 2, Master('Window'), x = 5, y = 7)\n\nEither one will work - we're just making argument delivery just a bit smarter than normal.\n\nOne more example, new in 1.1.0, you can now match string arguments using regular expressions, if you want. No need to define the re objects in advance - they can be right in the decorator call if you want.\n\n.. code-block:: python\n\n from typeargs import re, typeargs\n\n phoneNumber = re(r'\\d{3}-\\d{4}')\n ssn = re(r'\\d{3}-\\d{2}-\\d{4}')\n fullName = re(r'\\w+ \\w+')\n\n @typeargs(fullName, ssn, phoneNumber)\n def infos(fullName, ssn, phoneNumber):\n print(fullName, ssn, phoneNumber)\n\n infos('752-2723', 'Taylor Marks', '123-45-6789')\n # Prints out ('Taylor Marks', '123-45-6789', '752-2723')\n\nCopyright\n---------\nThis software is Copyright (c) 2016 Taylor Marks .\n\nSee the bundled LICENSE file for more information.", "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/TaylorSMarks/typeargs", "keywords": "positional args keyword keywords kwargs type typecheck safety typeargs", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "typeargs", "package_url": "https://pypi.org/project/typeargs/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/typeargs/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/TaylorSMarks/typeargs" }, "release_url": "https://pypi.org/project/typeargs/1.1.0/", "requires_dist": null, "requires_python": null, "summary": "Smarter positional argument handling", "version": "1.1.0" }, "last_serial": 1968925, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "88b124c024768a12e1b35e328468fbc0", "sha256": "472fb8aeba3a1cb55d0a336a043a22cf7663e87dbe542fd0a44aa586316bd95a" }, "downloads": -1, "filename": "typeargs-1.0.0.tar.gz", "has_sig": false, "md5_digest": "88b124c024768a12e1b35e328468fbc0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3951, "upload_time": "2016-02-07T18:25:04", "url": "https://files.pythonhosted.org/packages/06/06/a4048081828c42f2288438a3fdb95641809a5cf16e3d3bd116497456f1a1/typeargs-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "445fc52f0733b0398952c4ee58999e70", "sha256": "ddeb315d55875f6c8083346c681a3c140f9f2e155e2726add160b76225e43d2c" }, "downloads": -1, "filename": "typeargs-1.1.0.tar.gz", "has_sig": false, "md5_digest": "445fc52f0733b0398952c4ee58999e70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4460, "upload_time": "2016-02-22T04:08:12", "url": "https://files.pythonhosted.org/packages/a4/27/cd4f96d1f50f39b91e5ddc638e7b7681c9d3cc443b43c0baab9fa3ce5efe/typeargs-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "445fc52f0733b0398952c4ee58999e70", "sha256": "ddeb315d55875f6c8083346c681a3c140f9f2e155e2726add160b76225e43d2c" }, "downloads": -1, "filename": "typeargs-1.1.0.tar.gz", "has_sig": false, "md5_digest": "445fc52f0733b0398952c4ee58999e70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4460, "upload_time": "2016-02-22T04:08:12", "url": "https://files.pythonhosted.org/packages/a4/27/cd4f96d1f50f39b91e5ddc638e7b7681c9d3cc443b43c0baab9fa3ce5efe/typeargs-1.1.0.tar.gz" } ] }