{ "info": { "author": "Rigdon", "author_email": "mr.rigdon@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: Public Domain", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "Chipmunk\n========\n\n|Build Status|\n\nA very small and simple usage mechanism for Python threadlocals.\n----------------------------------------------------------------\n\nThis is an abstraction on type of ``threading.local`` that attempts to\nsimply usage a bit and combat the common problem of accidentally\noverwriting values that may have been added by other portions of code.\nIt also implements the ``in`` operator to test for inclusion and the\nbool() method to test whether the Chipmunk is holding anything.\n\nExample Usage\n-------------\n\nInstantiating\n~~~~~~~~~~~~~\n\nThe ``Chipmunk`` object is a sort of singleton that is instantiated upon\nimport.\n\n::\n\n from chipmunk import Chipmunk # Ready for use\n\nStoring Data\n~~~~~~~~~~~~\n\nAsking the ``Chipmunk`` to hold something can be done in one of three\nways:\n\nSetting Attributes Directly\n\n::\n\n Chipmunk.acorn = \"Acorn\"\n Chipmunk.acorn_count = 5\n\nWith the ``store_data`` method\n\n``Chipmunk.store_data(\"acorn\", \"Acorn\") Chipmunk.store_data(\"acorn_count\", 5)``\n\nAnd with a context manager for short-term storage that removes the need\nfor checking whether it is already holding something with the given\nname.\n\n::\n\n Chipmunk.nut = \"acorn\"\n\n with Chipmunk.hold_this(\"nut\", \"walnut\"):\n do_something_with_Chipmunk()\n\n return Chipmunk.nut # Returns \"acorn\"\n\nIf the ``Chipmunk`` is already holding something and you ask it to hold\nsomething else with the same name it will raise an AttributeError. If\nyou want to replace an object permanently you must call either the\n``delete_data`` or ``clear`` methods or use ``del Chipmunk.attr``.\n\n::\n\n Chipmunk.nut = \"acorn\"\n Chipmunk.nut = \"walnut\" # AttributeError thrown\n\n Chipmunk.nut = \"acorn\"\n del Chipmunk.nut\n Chipmunk.nut = \"walnut\" # OK\n\n Chipmunk.nut = \"acorn\"\n Chipmunk.delete_data(\"nut\")\n Chipmunk.nut = \"walnut\" # OK\n\nRetrieving Data\n~~~~~~~~~~~~~~~\n\nWhen retrieving data from the ``Chipmunk`` a ``bool()`` check will tell\nyou if it's holding anything at all.\n\n::\n\n from chipmunk import Chipmunk\n if Chipmunk: # Conditional fails\n return \"Not Empty\"\n\n Chipmunk.nut = \"acorn\"\n if Chipmunk: # Conditional succeeds\n return \"Not Empty\"\n\nTesting whether the ``Chipmunk`` is holding something with a given name\nis as simple as an ``in`` check.\n\n::\n\n Chipmunk.nut = \"acorn\"\n \"nut\" in Chipmunk # True\n\nData can be accessed by doing an attribute lookup directly, using the\n``get_data`` method, or ``getattr``.\n\n::\n\n Chipmunk.nut = \"acorn\"\n\n # These all return \"acorn\"\n Chipmunk.nut\n Chipmunk.get_data(\"nut\")\n getattr(Chipmunk, \"nut\")\n\n.. |Build Status| image:: https://travis-ci.org/Rigdon/chipmunk.svg?branch=develop\n :target: https://travis-ci.org/Rigdon/chipmunk", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/Rigdon/chipmunk/tarball/1.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Rigdon/chipmunk", "keywords": "utilities,locals,threading", "license": "The Unlicense", "maintainer": null, "maintainer_email": null, "name": "chipmunk", "package_url": "https://pypi.org/project/chipmunk/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/chipmunk/", "project_urls": { "Download": "https://github.com/Rigdon/chipmunk/tarball/1.0", "Homepage": "https://github.com/Rigdon/chipmunk" }, "release_url": "https://pypi.org/project/chipmunk/1.0.1/", "requires_dist": null, "requires_python": null, "summary": "A very small and simple usage mechanism for Python threadlocals.", "version": "1.0.1" }, "last_serial": 1720838, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "26924f362d9ee0716787efa85afc2b86", "sha256": "882d7e2a7dfba9f52cacfdc3c50e5aed60071c9bc174a93ef3db3da6d0452bad" }, "downloads": -1, "filename": "chipmunk-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "26924f362d9ee0716787efa85afc2b86", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 5701, "upload_time": "2015-09-13T16:40:48", "url": "https://files.pythonhosted.org/packages/42/41/507c5037cca0772a2a6645de8ad7fa1d5f4e09cfcaccb6a4f9647debd1ea/chipmunk-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "af59a9c0d0d1fc93b32fe23f05ada41c", "sha256": "59f13197d984ebd4d40e97fe1276328706033737fc149ceb85861db4e78833f2" }, "downloads": -1, "filename": "chipmunk-1.0.1.tar.gz", "has_sig": false, "md5_digest": "af59a9c0d0d1fc93b32fe23f05ada41c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3591, "upload_time": "2015-09-13T16:40:44", "url": "https://files.pythonhosted.org/packages/52/4c/a359e6d322ee11c28bfe2766ee61c9147d376569509356c81196b7a8a3b7/chipmunk-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "26924f362d9ee0716787efa85afc2b86", "sha256": "882d7e2a7dfba9f52cacfdc3c50e5aed60071c9bc174a93ef3db3da6d0452bad" }, "downloads": -1, "filename": "chipmunk-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "26924f362d9ee0716787efa85afc2b86", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 5701, "upload_time": "2015-09-13T16:40:48", "url": "https://files.pythonhosted.org/packages/42/41/507c5037cca0772a2a6645de8ad7fa1d5f4e09cfcaccb6a4f9647debd1ea/chipmunk-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "af59a9c0d0d1fc93b32fe23f05ada41c", "sha256": "59f13197d984ebd4d40e97fe1276328706033737fc149ceb85861db4e78833f2" }, "downloads": -1, "filename": "chipmunk-1.0.1.tar.gz", "has_sig": false, "md5_digest": "af59a9c0d0d1fc93b32fe23f05ada41c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3591, "upload_time": "2015-09-13T16:40:44", "url": "https://files.pythonhosted.org/packages/52/4c/a359e6d322ee11c28bfe2766ee61c9147d376569509356c81196b7a8a3b7/chipmunk-1.0.1.tar.gz" } ] }