{ "info": { "author": "Neil Cecchini", "author_email": "stranger.neil@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries" ], "description": "Annotated\n=========\nAnnotated provides a decorator that flags a function's annotations as useful, callable expressions. Each annotation will be called with its corresponding argument as first parameter, and the result will replace that argument.\n\nIf no annotation was specified for this particular argument, it will behave as if `lambda x: x` had been used as annotation.\n\n`@annotated` Decorator\n----------------------\nThe `@annotated` decorator is meant to decorate functions, or other objects with a `__code__` attribute (a class is **not** one). It indicates that the function decorated has \"active\" annotations, for example:\n\n```python\nfrom annotated import annotated\n\n@annotated\ndef hello(name: str):\n print('Hello, ' + name + '!')\n\nhello('world')\n# \"Hello, world!\"\nhello(None)\n# \"Hello, None!\"\n```\n\nAlbeit a bad example (one would rather use `str.format` or the `%` notation to include a value in a string), this illustrates the behaviour of an `@annotated` function.\n\nUsed this way, `@annotated` ensures that the `name` argument of the `hello` function is **always** a character string.\n\n`@annotated` also respects default values, and applies annotations to them. Thus, if we were to rewrite `hello` such as:\n\n```python\nfrom annotated import annotated\n\n@annotated\ndef hello(name: str='world'):\n print('Hello, ' + name + '!')\n\nhello()\n# \"Hello, world!\"\n```\n\nThe default value would be honored, as well as any non-defaults.\n\nIt should be noted that `@annotated` supports both return annotations (`->`), keyword argument annotations and `*`/`**` annotations.\n\nUsing `@annotated` on an incompatible (`__code__`-less) object will result in a `TypeError` exception.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/WhatNodyn/Annotate", "keywords": "annotations decorator function development", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "annotated", "package_url": "https://pypi.org/project/annotated/", "platform": "", "project_url": "https://pypi.org/project/annotated/", "project_urls": { "Homepage": "https://github.com/WhatNodyn/Annotate" }, "release_url": "https://pypi.org/project/annotated/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "Apply annotations as callables on their respective arguments", "version": "0.0.2" }, "last_serial": 3041332, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "e939911b7ca7d172149fcd1b7ccdae80", "sha256": "f303ce10cf0c4c2c8af1e07bcdc6dd21ff234fdfba142a023467f52fc427ea4c" }, "downloads": -1, "filename": "annotated-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "e939911b7ca7d172149fcd1b7ccdae80", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5061, "upload_time": "2017-07-22T11:40:03", "url": "https://files.pythonhosted.org/packages/64/5b/0519b960a3d6ab2478b6719dd17a44a018d9bd26bd0be8814369a24b980b/annotated-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bc50ce1826b0017fa420f2689ff6de4c", "sha256": "cc2ec645ceb370d2752b1196ef66ff482d8e3dc80eb3abe6dd92f9110f1b5d95" }, "downloads": -1, "filename": "annotated-0.0.1.tar.gz", "has_sig": false, "md5_digest": "bc50ce1826b0017fa420f2689ff6de4c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2963, "upload_time": "2017-07-22T11:40:06", "url": "https://files.pythonhosted.org/packages/a6/6c/6ddfefc2947b47aa9aa4ba482ba648cc2047e34ad2deed84c68f3f5f530e/annotated-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "eaf9af277792d0097fa8460a9773de42", "sha256": "14125fa5166d444da8d9f582014b00d9ae49eb00c459c0e42537105611ab8110" }, "downloads": -1, "filename": "annotated-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "eaf9af277792d0097fa8460a9773de42", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5054, "upload_time": "2017-07-22T11:50:10", "url": "https://files.pythonhosted.org/packages/3e/ef/e985819b40d16ec4fb19dd45332b5154b2b5316df2a11910861388de29d6/annotated-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aeaf12b891ed50497663bdd521c75ddc", "sha256": "a729257585dd88763a142405cb74fa0a9c5d0ff4f4d15ef376ed1cf86085a42d" }, "downloads": -1, "filename": "annotated-0.0.2.tar.gz", "has_sig": false, "md5_digest": "aeaf12b891ed50497663bdd521c75ddc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2956, "upload_time": "2017-07-22T11:50:12", "url": "https://files.pythonhosted.org/packages/da/54/26a73f158fca65bc14be01b25358c183f2939223e9d46b55124363dacd7d/annotated-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eaf9af277792d0097fa8460a9773de42", "sha256": "14125fa5166d444da8d9f582014b00d9ae49eb00c459c0e42537105611ab8110" }, "downloads": -1, "filename": "annotated-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "eaf9af277792d0097fa8460a9773de42", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5054, "upload_time": "2017-07-22T11:50:10", "url": "https://files.pythonhosted.org/packages/3e/ef/e985819b40d16ec4fb19dd45332b5154b2b5316df2a11910861388de29d6/annotated-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aeaf12b891ed50497663bdd521c75ddc", "sha256": "a729257585dd88763a142405cb74fa0a9c5d0ff4f4d15ef376ed1cf86085a42d" }, "downloads": -1, "filename": "annotated-0.0.2.tar.gz", "has_sig": false, "md5_digest": "aeaf12b891ed50497663bdd521c75ddc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2956, "upload_time": "2017-07-22T11:50:12", "url": "https://files.pythonhosted.org/packages/da/54/26a73f158fca65bc14be01b25358c183f2939223e9d46b55124363dacd7d/annotated-0.0.2.tar.gz" } ] }