{ "info": { "author": "Victor Williams Stafusa da Silva", "author_email": "victorwssilva@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# inject-globals\nA function for injecting global variables into function calls.\n\n## Usage example:\n\nA simple usage example is this:\n\n```python\nfrom inject_globals import inject_globals\n\n@inject_globals(a = \"Hello\", b = \"World\")\ndef hello():\n print(f\"{a} {b}\")\n\nhello()\n```\n\nHowever, that example is somewhat silly. It's power shows up when you are creating other decorators, like this one:\n\n```python\ndef run_n_times(n):\n def middle(func):\n from functools import wraps\n\n @wraps(func)\n def inner(*args, **kwargs):\n r = []\n for i in range(1, n + 1):\n r.append(inject_globals(it = i)(func)(*args, **kwargs))\n return r\n return inner\n return middle\n\n@run_n_times(3)\ndef foo():\n return f\"This is the iteration #{it}.\"\n\nassert foo() == [\"This is the iteration #1.\", \"This is the iteration #2.\", \"This is the iteration #3.\"]\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/victorwss/inject-globals", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "inject-globals", "package_url": "https://pypi.org/project/inject-globals/", "platform": "", "project_url": "https://pypi.org/project/inject-globals/", "project_urls": { "Homepage": "https://github.com/victorwss/inject-globals" }, "release_url": "https://pypi.org/project/inject-globals/1.0.0.4/", "requires_dist": null, "requires_python": "", "summary": "A decorator for injecting global variables into function calls.", "version": "1.0.0.4" }, "last_serial": 5160639, "releases": { "1.0.0.4": [ { "comment_text": "", "digests": { "md5": "c4a875fd44827dd814bef5b827867e0a", "sha256": "d0864849061b21401e883053391ed4487f1407128965faa86410809f4ff9cda2" }, "downloads": -1, "filename": "inject-globals-1.0.0.4.tar.gz", "has_sig": false, "md5_digest": "c4a875fd44827dd814bef5b827867e0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2002, "upload_time": "2019-04-18T14:37:02", "url": "https://files.pythonhosted.org/packages/6d/e8/05eae55a166d3f95c1ecf8d1056d9bfbcbfc8ca36cb977810f2f4289ee1c/inject-globals-1.0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c4a875fd44827dd814bef5b827867e0a", "sha256": "d0864849061b21401e883053391ed4487f1407128965faa86410809f4ff9cda2" }, "downloads": -1, "filename": "inject-globals-1.0.0.4.tar.gz", "has_sig": false, "md5_digest": "c4a875fd44827dd814bef5b827867e0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2002, "upload_time": "2019-04-18T14:37:02", "url": "https://files.pythonhosted.org/packages/6d/e8/05eae55a166d3f95c1ecf8d1056d9bfbcbfc8ca36cb977810f2f4289ee1c/inject-globals-1.0.0.4.tar.gz" } ] }