{ "info": { "author": "(the author)", "author_email": "mdilligaf@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Frozen\n---------------------------------\n\nFrozen creates an immutable reference to an object. This works (lazily) recursive: mutable members are also frozen upon access. It keeps the original object mutable, returning a proxy class that behaves just like the object except being uneditable. If the underlying object changes, the proxy will reflect this automatically. As such it is immutable in the sense that the reference can't be used to change it, not in the sense that it cannot be changed at all (you could of course discard the original mutable reference). Frozen objects can not be used as dictionary keys.\n\nInstallation\n---------------------------------\n\n1. `pip install frozenobj`\n2. profit\n\nUsage\n---------------------------------\n\nUsage is very simple::\n\n\tfrom frozenobj import frozen\n\timmutable_obj = frozen(mutable_obj)\n\n\nAs a simple example::\n\n\tclass Cls:\n\t\tdef __init__(self):\n\t\t\tself.li = [37, 42]\n\toriginal = Cls()\n\tfreezered = frozen(original)\n\toriginal.li.append(99) # works\n\tfreezered.li.append(99) # ImmutableError\n\nHave a look at `tests.py`_ for more examples.\n\nNotes\n---------------------------------\n\n* Someone really determined to change your proxy object can find ways to do so. This is not a security measure, it's just a way to enforce your interface (in the purely imaginary case that people don't read or follow the manual saying they shouldn't change things).\n* It should work for most objects. It works for classes, class instances, modules, lists, sets, dictionaries and some types derived from them. It implicitly works for ints, floats, strings and tuples which are always immutable (they are returned, not proxied). Functions and methods are also considered constants.\n* The `frozen` method is idempotent and uses caching: if you call it twice on the same object, either successively or in parallel, you get the same proxy.\n* The recursive freezing on access, while not completely free, should have fairly low computational cost (you need store only values that are accessed a great many times).\n* Heavily relies on the `lazy-object-proxy`_ package, which is nice.\n\nLicense\n---------------------------------\n\nFrozen is available under the revised BSD license, see LICENSE.txt. You can do anything as long as you include the license, don't use my name for promotion and are aware that there is no warranty.\n\n\n.. _tests.py: https://github.com/mverleg/python_frozen/blob/master/tests.py\n.. _lazy-object-proxy: https://pypi.python.org/pypi/lazy-object-proxy", "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/mverleg/python_frozen", "keywords": null, "license": "LICENSE.txt", "maintainer": null, "maintainer_email": null, "name": "frozenobj", "package_url": "https://pypi.org/project/frozenobj/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/frozenobj/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/mverleg/python_frozen" }, "release_url": "https://pypi.org/project/frozenobj/1.0/", "requires_dist": null, "requires_python": null, "summary": "Get a python_frozen reference to an object.", "version": "1.0" }, "last_serial": 2020650, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "d937ab79d448a091c341f29eede8c03d", "sha256": "3147136487cb67baf736e032c003adbd4fc658e867ff4b77f92a2957199239c8" }, "downloads": -1, "filename": "frozenobj-1.0.tar.gz", "has_sig": false, "md5_digest": "d937ab79d448a091c341f29eede8c03d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4724, "upload_time": "2016-03-22T14:19:51", "url": "https://files.pythonhosted.org/packages/2e/bc/14fb404e96c28681be9b9a1bf330244bdcddd2fa8ff722965b25cdca1864/frozenobj-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d937ab79d448a091c341f29eede8c03d", "sha256": "3147136487cb67baf736e032c003adbd4fc658e867ff4b77f92a2957199239c8" }, "downloads": -1, "filename": "frozenobj-1.0.tar.gz", "has_sig": false, "md5_digest": "d937ab79d448a091c341f29eede8c03d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4724, "upload_time": "2016-03-22T14:19:51", "url": "https://files.pythonhosted.org/packages/2e/bc/14fb404e96c28681be9b9a1bf330244bdcddd2fa8ff722965b25cdca1864/frozenobj-1.0.tar.gz" } ] }