{ "info": { "author": "Carlos Escribano Rey", "author_email": "carlos@nettoys.es", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Topic :: Software Development" ], "description": "dotted\n======\n\n.. image:: https://pypip.in/version/dotted/badge.svg?style=flat\n :target: https://pypi.python.org/pypi/dotted/\n :alt: Latest Version\n.. image:: https://travis-ci.org/carlosescri/DottedDict.svg?branch=master\n :target: https://travis-ci.org/carlosescri/DottedDict\n\nA Python library that provides a method of accessing lists and dicts with a\ndotted path notation. It is useful to access a deep path inside a complex\nobject composed of lists and dicts.\n\nQuick & Dirty:\n==============\n\n.. code-block:: python\n\n from dotted.collection import DottedCollection, DottedDict, DottedList\n\n obj = DottedCollection.factory(dict_or_list)\n obj = DottedCollection.load_json(json_value)\n obj = DottedDict(a_dict)\n obj = DottedList(a_list)\n\n from dotted.utils import dot, dot_json\n\n obj = dot(dict_or_list)\n obj = dot_json(json_value)\n\n``DottedDict`` and ``DottedList`` have the same accessors as ``dict`` and ``list``\nso you can iterate them as usual. Both type of objects support access via a\ndotted path key.\n\nExamples\n========\n\nExample #1: DottedList\n----------------------\n\n.. code-block:: python\n\n obj = DottedList([0, 1, 2, 3, [4, 5, 6], 7, 8, [9, 10]])\n\nAll of these are true:\n\n.. code-block:: python\n\n obj[0] == 0\n obj['1'] == 1\n obj['4.0'] == 4\n obj['4.2'] == 6\n obj[5] == 7\n obj['7.1'] == 10\n\nIf you want to append you can do:\n\n.. code-block:: python\n\n obj.append(12)\n\nor:\n\n.. code-block:: python\n\n obj[8] = 11\n\nbut the latter only works if ``index == len(obj)``. In other case you will get a\nvery pretty exception.\n\nExample #2: DottedDict\n----------------------\n\n.. code-block:: python\n\n obj = DottedDict({'hello': {'world': {'wide': 'web'}}})\n\nAll of these are true:\n\n.. code-block:: python\n\n obj['hello'] == {'world': {'wide': 'web'}}\n obj['hello.world'] == {'wide': 'web'}\n obj['hello.world.wide'] == 'web'\n\n obj.hello == {'world': {'wide': 'web'}}\n obj.hello.world == {'wide': 'web'}\n obj.hello.world.wide == 'web'\n\nExample #3: Both working together\n---------------------------------\n\n.. code-block:: python\n\n obj = DottedCollection.factory({\n 'hello': [{'world': {'wide': ['web', 'web', 'web']}}]\n })\n\nYou can access:\n\n.. code-block:: python\n\n obj['hello'][0]['world']['wide'][0]\n obj.hello[0].world.wide[0]\n obj.hello[0].world['wide'][0]\n obj.hello[0].world['wide.0']\n obj.hello['0.world'].wide[0]\n ...\n obj['hello.0.world.wide.0']\n\nExample #4: When new values are dicts or lists\n----------------------------------------------\n\n.. code-block:: python\n\n obj = DottedCollection.factory(some_obj)\n\n obj['some.path'] = {'hello': 'world'} # will be converted to a DottedDict\n obj['another.path'] = ['hello'] # will be converted to a DottedList\n\nExample #5: Shortcuts\n---------------------\n\n.. code-block:: python\n\n from dotted.utils import dot, dot_json\n\n obj = dot({'hello': 'world'})\n obj = dot_json('{\"hello\": \"world\"}')\n\nExample #6: Keys with dots inside!\n----------------------------------\n\nWell, you can actually use escaped keys, but it's better to avoid them:\n\n.. code-block:: python\n\n from dotted.utils import dot, dot_json\n obj = dot({\"hello\\.world\": \"Hello!\"})\n obj = dot_json('{\"hello\\\\\\\\.world\": \"Hello!\"}')\n value = obj[\"hello\\.world\"] # Hello!\n\nThat's all!\n\nTests\n=====\n\nRun in the terminal from the parent directory:\n\n.. code-block:: console\n\n python -m dotted.test.test_collection\n\nSpecial Thanks\n==============\n\n- **Marc Abramowitz** (`@msabramo`_)\n- **Ryan Witt** (`@ryanwitt`_)\n\n.. _@msabramo: https://github.com/msabramo\n.. _@ryanwitt: https://github.com/ryanwitt", "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/carlosescri/DottedDict", "keywords": null, "license": "The MIT License (MIT)\n\nCopyright (c) 2014 Carlos Escribano Rey\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "dotted", "package_url": "https://pypi.org/project/dotted/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/dotted/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/carlosescri/DottedDict" }, "release_url": "https://pypi.org/project/dotted/0.1.8/", "requires_dist": null, "requires_python": null, "summary": "Access dicts and lists with a dotted path notation.", "version": "0.1.8" }, "last_serial": 1793310, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1189e8cc33286c83974b22184fa3cf06", "sha256": "9a6a85f789ea76ae3458a07ad263313127e320686b81839541eb1a0b9cf1a49e" }, "downloads": -1, "filename": "dotted-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1189e8cc33286c83974b22184fa3cf06", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6673, "upload_time": "2014-03-28T17:43:11", "url": "https://files.pythonhosted.org/packages/ba/cc/46194e5cbc2b15ee4e9b6d6f6997749e040731eaf8d25185494b3f566182/dotted-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "87d6894d4c32185531c25079ceb1624a", "sha256": "76c8c06bbf5bcfb5586ede417f3f79669e311526876415620494a9f6af747eba" }, "downloads": -1, "filename": "dotted-0.1.1.tar.gz", "has_sig": false, "md5_digest": "87d6894d4c32185531c25079ceb1624a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6761, "upload_time": "2014-11-24T11:42:49", "url": "https://files.pythonhosted.org/packages/45/3c/6a9d1b87d11c77573c0c1b7784e506fefd16e387e074cd24b493157387d8/dotted-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "00d2d957c6e680890580a2fbbe16078a", "sha256": "2b7baedbfc3e50361c2b71090b70ebf4466ad724c630cdfdd7127efbd0ee39d6" }, "downloads": -1, "filename": "dotted-0.1.2.tar.gz", "has_sig": false, "md5_digest": "00d2d957c6e680890580a2fbbe16078a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7669, "upload_time": "2015-01-19T18:31:37", "url": "https://files.pythonhosted.org/packages/6c/c6/0a5d3a4cef7b1a15c50382a0b00b36eba33cd8d835cde028928b1069ed73/dotted-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "250d46818afab80cb441f9179f85233d", "sha256": "60d98a694fd3a1f14dbcf080845e6e2ee8370db9e953433f996266750dd21fa5" }, "downloads": -1, "filename": "dotted-0.1.3.tar.gz", "has_sig": false, "md5_digest": "250d46818afab80cb441f9179f85233d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8503, "upload_time": "2015-07-20T11:52:01", "url": "https://files.pythonhosted.org/packages/36/93/edcf17c2e7980dee61b20538ac9c3b8719d6943e4f6dad7bbdd0261a0ecc/dotted-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "dbf3dfefa95297f7be2af349ccfd13ae", "sha256": "050f9a0c7033605cb2e41c6abc10efa0e14e6d3ac20760fe28a11b3816acedc6" }, "downloads": -1, "filename": "dotted-0.1.4.tar.gz", "has_sig": false, "md5_digest": "dbf3dfefa95297f7be2af349ccfd13ae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8703, "upload_time": "2015-08-21T09:18:35", "url": "https://files.pythonhosted.org/packages/64/58/4ee8066ab37483311938f1b336ee17abbd4a00fe8b2dd82d290c45f8b9b1/dotted-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "bbb19fa17fe3d878e0ad56323924e23a", "sha256": "3ea6f027afc43cbeef7bb76b901aaffa112a3007cf9ccdf96fae84a40a87031a" }, "downloads": -1, "filename": "dotted-0.1.5.tar.gz", "has_sig": false, "md5_digest": "bbb19fa17fe3d878e0ad56323924e23a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8906, "upload_time": "2015-10-30T09:11:09", "url": "https://files.pythonhosted.org/packages/5e/47/d09b18e39db898ae225d549679dd61bf8116c330c274df8bf143eb1134ae/dotted-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "6e60d02c21e99c3b9dc0926064feaa05", "sha256": "0ed05a5065553ce09466698a20adfca425b3872970c3ce4cb3a88a5180e6f6e7" }, "downloads": -1, "filename": "dotted-0.1.6.tar.gz", "has_sig": false, "md5_digest": "6e60d02c21e99c3b9dc0926064feaa05", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8926, "upload_time": "2015-10-30T09:19:50", "url": "https://files.pythonhosted.org/packages/b2/2f/c59db01cd60aac6f4de1a479629f17febb37f804dee5ce23701ac90417e2/dotted-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "f445fbd829bfb6955e033c3174b400cb", "sha256": "f034fcd9da9dff0f549d21e3484d07d4f57aabaff6dc8a48cbbbef22953a0095" }, "downloads": -1, "filename": "dotted-0.1.7.tar.gz", "has_sig": false, "md5_digest": "f445fbd829bfb6955e033c3174b400cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8922, "upload_time": "2015-10-30T09:31:19", "url": "https://files.pythonhosted.org/packages/91/23/a8641638308427241c39bb70ade6034d8584d33f7ba174a2baa99c97a859/dotted-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "505f95a2c1a73b88b9ef823b3cce88c1", "sha256": "e0334688d854461b3b065e54b80781cd7cd2545e0692756c5244be0aeec41bdf" }, "downloads": -1, "filename": "dotted-0.1.8.tar.gz", "has_sig": false, "md5_digest": "505f95a2c1a73b88b9ef823b3cce88c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8938, "upload_time": "2015-10-30T10:13:57", "url": "https://files.pythonhosted.org/packages/64/1b/9b00a961c7d2b3619df9ca930b3d800ef4f0988e0df84618e14250d1f42e/dotted-0.1.8.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "505f95a2c1a73b88b9ef823b3cce88c1", "sha256": "e0334688d854461b3b065e54b80781cd7cd2545e0692756c5244be0aeec41bdf" }, "downloads": -1, "filename": "dotted-0.1.8.tar.gz", "has_sig": false, "md5_digest": "505f95a2c1a73b88b9ef823b3cce88c1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8938, "upload_time": "2015-10-30T10:13:57", "url": "https://files.pythonhosted.org/packages/64/1b/9b00a961c7d2b3619df9ca930b3d800ef4f0988e0df84618e14250d1f42e/dotted-0.1.8.tar.gz" } ] }