{ "info": { "author": "wouter bolsterlee", "author_email": "wouter@bolsterl.ee", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: BSD License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "=================\nattribute-mapping\n=================\n\n``attribute-mapping`` is a minimalistic Python library for\nattribute-based access to dictionaries and other mappings.\n\nCompared to many other implementations of the same idea, going by\nnames such as ``AttrDict`` and various others, this library is\nextremely minimal and free of cruft:\n\n- Almost no API\n\n- ``AttributeMapping`` instances do not pretend to be a ``dict``\n\n- Can be used with ``dict`` as well as other objects implementing the\n ``collections.abc.Mapping`` abstract base class\n\n- No restrictions on key/attribute names\n\n- No unpleasant surprises in behaviour or weird corner cases\n\n- Modern code; Python 3.4+ only\n\n- 100% test coverage\n\n\nInstallation\n============\n\n::\n\n python -m pip install attribute-mapping\n\n\nUsage\n=====\n\nMake an ``AttributeMapping`` instance by passing a dictionary or\nanother mapping::\n\n from attribute_mapping import AttributeMapping\n\n d = {\"a\": 1, \"b\": {\"c\": 2, \"d\": 3}}\n x = AttributeMapping(d)\n\nNow you can access the contents using attribute lookups::\n\n x.a # gives 1\n x.b.c # gives 2\n\n x.foo = 123\n hasattr(x, \"foo\") # True\n del x.foo\n\nIn addition to attribute access, subscription (``__getitem__`` and\nfriends) and containment checks (``in``) also work::\n\n x[\"a\"] # gives 1\n x[\"b\"][\"c\"] # gives 2\n x[\"foo\"] = 123\n \"foo\" in x # True\n del x[\"foo\"]\n\nHowever, there are *no* other dict-like methods or reserved names, so\nyou can happily use attributes like ``keys`` and ``items``::\n\n x.items = [1, 2, 3]\n\nIteration yields ``(key, value)`` tuples, just like ``.items()`` on\nnormal mappings would do::\n\n for key, value in x:\n ...\n\nFinally, to obtain the original object that was used for the\n``AttributeMapping``, use the built-in ``vars()`` function::\n\n d = {\"a\": 1}\n x = AttributeMapping(d)\n vars(x) is d # True\n\n\nCredits\n=======\n\nThis library is written by wouter bolsterlee (wbolster).\n\nThere are a gazillion similar implementations, so the author thanks\nthe whole Python community for the inspiration to make yet another\nimplementation of this idea.\n\n\nVersion history\n===============\n\n* 1.3.0 (2019-03-13)\n\n * Add support for ``len()``\n\n* 1.2.0 (2019-03-12)\n\n * Add support for (in)equality tests\n\n* 1.1.0 (2019-03-09)\n\n * Add support for custom mappings\n\n* 1.0.0 (2019-03-08)\n\n * Initial release\n\n\nLicense\n=======\n\nBSD; see LICENSE file for details.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wbolster/attribute-mapping", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "attribute-mapping", "package_url": "https://pypi.org/project/attribute-mapping/", "platform": "", "project_url": "https://pypi.org/project/attribute-mapping/", "project_urls": { "Homepage": "https://github.com/wbolster/attribute-mapping" }, "release_url": "https://pypi.org/project/attribute-mapping/1.3.0/", "requires_dist": null, "requires_python": "", "summary": "minimalistic library for attribute-based access to dictionaries and other mappings", "version": "1.3.0" }, "last_serial": 4933948, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "8e096f1c34311c0e2464bd8bdde08426", "sha256": "98065f29a597a37f347cf8b5b913ba0bb8273275f863c8283eec45f344ca656c" }, "downloads": -1, "filename": "attribute_mapping-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "8e096f1c34311c0e2464bd8bdde08426", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3892, "upload_time": "2019-03-08T22:04:09", "url": "https://files.pythonhosted.org/packages/91/cb/8e29d05d13ad2339650de6a73d8051d484aa0b1cf79de906300a528c6db7/attribute_mapping-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d34b75cfbd1d053169fbe9e63ba68b68", "sha256": "67f2ff35eb6643be7a9f5333d7331a3539141004804aa627a3bfa2b828307de4" }, "downloads": -1, "filename": "attribute-mapping-1.0.0.tar.gz", "has_sig": false, "md5_digest": "d34b75cfbd1d053169fbe9e63ba68b68", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3626, "upload_time": "2019-03-08T22:04:11", "url": "https://files.pythonhosted.org/packages/11/94/3cdfcc9d46b5f50ad4e370b6251b25e0cecf1c46a612a0a1621f6d14ab37/attribute-mapping-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "f3ce262d80808c071e4776494273b995", "sha256": "5a42d0a251d1a5d7b51525c480ff77cc5a3dcb593e4d579ad156266ef537ffe7" }, "downloads": -1, "filename": "attribute_mapping-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "f3ce262d80808c071e4776494273b995", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4099, "upload_time": "2019-03-09T10:39:35", "url": "https://files.pythonhosted.org/packages/3f/5d/7c0aae231d363b791d06f5c733c81a9e98f12687559a5daa89e79f78516c/attribute_mapping-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "75ca9e9ca2fc8ca2ce2fd71cd41507ca", "sha256": "0ba0441b52e7106a6c3c9b8dc17704e86f95374e33114759adff27580c6a98bc" }, "downloads": -1, "filename": "attribute-mapping-1.1.0.tar.gz", "has_sig": false, "md5_digest": "75ca9e9ca2fc8ca2ce2fd71cd41507ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3904, "upload_time": "2019-03-09T10:40:20", "url": "https://files.pythonhosted.org/packages/a7/a9/773af1db1c9520ae5f7f1797a49ee6925d43b9dfffd8a678aee1d1e883c2/attribute-mapping-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "b8425f2e1eb1d4a080e773d45c6c81fd", "sha256": "d32e504f64197c8290fcaf80ccadfc7fd6669e72ef587fb38b87b54a4e16431e" }, "downloads": -1, "filename": "attribute_mapping-1.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b8425f2e1eb1d4a080e773d45c6c81fd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4164, "upload_time": "2019-03-12T15:52:49", "url": "https://files.pythonhosted.org/packages/bd/d7/f97c1f68f8eb47ae688651b50530253ed94bfcf37e814230501bd821a8da/attribute_mapping-1.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "86ab6ed00683056d45cd5f571b5c0822", "sha256": "4d4cb45bb026f89357b6dc4115749d1b0935c66ce177876ae4060f01ff07e454" }, "downloads": -1, "filename": "attribute-mapping-1.2.0.tar.gz", "has_sig": false, "md5_digest": "86ab6ed00683056d45cd5f571b5c0822", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3972, "upload_time": "2019-03-12T15:52:52", "url": "https://files.pythonhosted.org/packages/e3/16/cea8d0e298004c7a2aeb5f2e99f98bf53bff9fe799d74f581b775849dc81/attribute-mapping-1.2.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "7b561712382f68162ffc1ef2e1c7af86", "sha256": "f0df141be071a72ef03685d1c35930fb331a430f508e7d71c32dc3cda848f4bb" }, "downloads": -1, "filename": "attribute_mapping-1.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7b561712382f68162ffc1ef2e1c7af86", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4189, "upload_time": "2019-03-13T10:18:32", "url": "https://files.pythonhosted.org/packages/bf/d7/0a25b69095230c4e93441cbef62f7f0aca8f58c414f06c53d5d02bfebe48/attribute_mapping-1.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e1c3b1564eb6d09e5aaa1fbb3805f465", "sha256": "f0a9a32cd8850977675a67642a0f050b7bcc03be3701e46ce9fc8d3cc61b9595" }, "downloads": -1, "filename": "attribute-mapping-1.3.0.tar.gz", "has_sig": false, "md5_digest": "e1c3b1564eb6d09e5aaa1fbb3805f465", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4023, "upload_time": "2019-03-13T10:18:42", "url": "https://files.pythonhosted.org/packages/a5/7b/c4adf610559652851ae613dfdbeae86281d0dfeb78b33ad1a8c8aa78582a/attribute-mapping-1.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7b561712382f68162ffc1ef2e1c7af86", "sha256": "f0df141be071a72ef03685d1c35930fb331a430f508e7d71c32dc3cda848f4bb" }, "downloads": -1, "filename": "attribute_mapping-1.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "7b561712382f68162ffc1ef2e1c7af86", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4189, "upload_time": "2019-03-13T10:18:32", "url": "https://files.pythonhosted.org/packages/bf/d7/0a25b69095230c4e93441cbef62f7f0aca8f58c414f06c53d5d02bfebe48/attribute_mapping-1.3.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e1c3b1564eb6d09e5aaa1fbb3805f465", "sha256": "f0a9a32cd8850977675a67642a0f050b7bcc03be3701e46ce9fc8d3cc61b9595" }, "downloads": -1, "filename": "attribute-mapping-1.3.0.tar.gz", "has_sig": false, "md5_digest": "e1c3b1564eb6d09e5aaa1fbb3805f465", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4023, "upload_time": "2019-03-13T10:18:42", "url": "https://files.pythonhosted.org/packages/a5/7b/c4adf610559652851ae613dfdbeae86281d0dfeb78b33ad1a8c8aa78582a/attribute-mapping-1.3.0.tar.gz" } ] }