Name | dotty-dict JSON |
Version |
1.3.1
JSON |
| download |
home_page | |
Summary | Dictionary wrapper for quick access to deeply nested keys. |
upload_time | 2022-07-09 18:50:57 |
maintainer | |
docs_url | None |
author | Pawel Zadrozny |
requires_python | >=3.5,<4.0 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
**********
Dotty-Dict
**********
:Info: Dictionary wrapper for quick access to deeply nested keys.
:Author: Pawel Zadrozny @pawelzny <pawel.zny@gmail.com>
.. image:: https://circleci.com/gh/pawelzny/dotty_dict/tree/master.svg?style=shield&circle-token=77f51e87481f339d69ca502fdbb0c2b1a76c0369
:target: https://circleci.com/gh/pawelzny/dotty_dict/tree/master
:alt: CI Status
.. image:: https://readthedocs.org/projects/vo/badge/?version=latest
:target: http://dotty-dict.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://img.shields.io/pypi/v/dotty_dict.svg
:target: https://pypi.org/project/dotty_dict/
:alt: PyPI Repository Status
.. image:: https://img.shields.io/github/release/pawelzny/dotty_dict.svg
:target: https://github.com/pawelzny/dotty_dict
:alt: Release Status
.. image:: https://img.shields.io/pypi/status/dotty_dict.svg
:target: https://pypi.org/project/dotty_dict/
:alt: Project Status
.. image:: https://img.shields.io/pypi/pyversions/dotty_dict.svg
:target: https://pypi.org/project/dotty_dict/
:alt: Supported python versions
.. image:: https://img.shields.io/pypi/implementation/dotty_dict.svg
:target: https://pypi.org/project/dotty_dict/
:alt: Supported interpreters
.. image:: https://img.shields.io/pypi/l/dotty_dict.svg
:target: https://github.com/pawelzny/dotty_dict/blob/master/LICENSE
:alt: License
Features
========
* Simple wrapper around python dictionary and dict like objects
* Two wrappers with the same dict are considered equal
* Access to deeply nested keys with dot notation: ``dot['deeply.nested.key']``
* Create, read, update and delete nested keys of any length
* Expose all dictionary methods like ``.get``, ``.pop``, ``.keys`` and other
* Access dicts in lists by index ``dot['parents.0.first_name']``
* key=value caching to speed up lookups and low down memory consumption
* support for setting value in multidimensional lists
* support for accessing lists with slices
Installation
============
.. code:: bash
pip install dotty-dict
* **Package**: https://pypi.org/project/dotty-dict/
* **Source**: https://github.com/pawelzny/dotty_dict
Documentation
=============
* Full documentation: http://dotty-dict.readthedocs.io
* Public API: http://dotty-dict.readthedocs.io/en/latest/api.html
* Examples and usage ideas: http://dotty-dict.readthedocs.io/en/latest/examples.html
TODO
====
Waiting for your feature requests ;)
Quick Example
=============
Create new dotty using factory function.
.. code-block:: python
>>> from dotty_dict import dotty
>>> dot = dotty({'plain': {'old': {'python': 'dictionary'}}})
>>> dot['plain.old']
{'python': 'dictionary'}
You can start with empty dotty
.. code-block:: python
>>> from dotty_dict import dotty
>>> dot = dotty()
>>> dot['very.deeply.nested.thing'] = 'spam'
>>> dot
Dotty(dictionary={'very': {'deeply': {'nested': {'thing': 'spam'}}}}, separator='.', esc_char='\\')
>>> dot['very.deeply.spam'] = 'indeed'
>>> dot
Dotty(dictionary={'very': {'deeply': {'nested': {'thing': 'spam'}, 'spam': 'indeed'}}}, separator='.', esc_char='\\')
>>> del dot['very.deeply.nested']
>>> dot
Dotty(dictionary={'very': {'deeply': {'spam': 'indeed'}}}, separator='.', esc_char='\\')
>>> dot.get('very.not_existing.key')
None
NOTE: Using integer in dictionary keys will be treated as embedded list index.
Install for development
=======================
Install dev dependencies
.. code-block:: console
$ make install
Testing
=======
.. code-block:: console
$ make test
Or full tests with TOX:
.. code-block:: console
$ make test-all
Limitations
===========
In some very rare cases dotty may not work properly.
* When nested dictionary has two keys of different type, but with the same value.
In that case dotty will return dict or list under random key with passed value.
* Keys in dictionary may not contain dots. If you need to use dots, please specify dotty with custom separator.
* Nested keys may not be bool type. Bool type keys are only supported when calling keys with type defined value (e.g. dot[True], dot[False]).
Raw data
{
"_id": null,
"home_page": "",
"name": "dotty-dict",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Pawel Zadrozny",
"author_email": "pawel.zny@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6a/ab/88d67f02024700b48cd8232579ad1316aa9df2272c63049c27cc094229d6/dotty_dict-1.3.1.tar.gz",
"platform": null,
"description": "**********\nDotty-Dict\n**********\n\n:Info: Dictionary wrapper for quick access to deeply nested keys.\n:Author: Pawel Zadrozny @pawelzny <pawel.zny@gmail.com>\n\n.. image:: https://circleci.com/gh/pawelzny/dotty_dict/tree/master.svg?style=shield&circle-token=77f51e87481f339d69ca502fdbb0c2b1a76c0369\n :target: https://circleci.com/gh/pawelzny/dotty_dict/tree/master\n :alt: CI Status\n\n.. image:: https://readthedocs.org/projects/vo/badge/?version=latest\n :target: http://dotty-dict.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n.. image:: https://img.shields.io/pypi/v/dotty_dict.svg\n :target: https://pypi.org/project/dotty_dict/\n :alt: PyPI Repository Status\n\n.. image:: https://img.shields.io/github/release/pawelzny/dotty_dict.svg\n :target: https://github.com/pawelzny/dotty_dict\n :alt: Release Status\n\n.. image:: https://img.shields.io/pypi/status/dotty_dict.svg\n :target: https://pypi.org/project/dotty_dict/\n :alt: Project Status\n\n.. image:: https://img.shields.io/pypi/pyversions/dotty_dict.svg\n :target: https://pypi.org/project/dotty_dict/\n :alt: Supported python versions\n\n.. image:: https://img.shields.io/pypi/implementation/dotty_dict.svg\n :target: https://pypi.org/project/dotty_dict/\n :alt: Supported interpreters\n\n.. image:: https://img.shields.io/pypi/l/dotty_dict.svg\n :target: https://github.com/pawelzny/dotty_dict/blob/master/LICENSE\n :alt: License\n\n\nFeatures\n========\n\n* Simple wrapper around python dictionary and dict like objects\n* Two wrappers with the same dict are considered equal\n* Access to deeply nested keys with dot notation: ``dot['deeply.nested.key']``\n* Create, read, update and delete nested keys of any length\n* Expose all dictionary methods like ``.get``, ``.pop``, ``.keys`` and other\n* Access dicts in lists by index ``dot['parents.0.first_name']``\n* key=value caching to speed up lookups and low down memory consumption\n* support for setting value in multidimensional lists\n* support for accessing lists with slices\n\n\nInstallation\n============\n\n.. code:: bash\n\n pip install dotty-dict\n\n\n* **Package**: https://pypi.org/project/dotty-dict/\n* **Source**: https://github.com/pawelzny/dotty_dict\n\n\nDocumentation\n=============\n\n* Full documentation: http://dotty-dict.readthedocs.io\n* Public API: http://dotty-dict.readthedocs.io/en/latest/api.html\n* Examples and usage ideas: http://dotty-dict.readthedocs.io/en/latest/examples.html\n\n\nTODO\n====\n\nWaiting for your feature requests ;)\n\n\nQuick Example\n=============\n\nCreate new dotty using factory function.\n\n.. code-block:: python\n\n >>> from dotty_dict import dotty\n >>> dot = dotty({'plain': {'old': {'python': 'dictionary'}}})\n >>> dot['plain.old']\n {'python': 'dictionary'}\n\n\nYou can start with empty dotty\n\n.. code-block:: python\n\n >>> from dotty_dict import dotty\n >>> dot = dotty()\n >>> dot['very.deeply.nested.thing'] = 'spam'\n >>> dot\n Dotty(dictionary={'very': {'deeply': {'nested': {'thing': 'spam'}}}}, separator='.', esc_char='\\\\')\n\n >>> dot['very.deeply.spam'] = 'indeed'\n >>> dot\n Dotty(dictionary={'very': {'deeply': {'nested': {'thing': 'spam'}, 'spam': 'indeed'}}}, separator='.', esc_char='\\\\')\n\n >>> del dot['very.deeply.nested']\n >>> dot\n Dotty(dictionary={'very': {'deeply': {'spam': 'indeed'}}}, separator='.', esc_char='\\\\')\n\n >>> dot.get('very.not_existing.key')\n None\n\nNOTE: Using integer in dictionary keys will be treated as embedded list index.\n\nInstall for development\n=======================\n\nInstall dev dependencies\n\n.. code-block:: console\n\n $ make install\n\nTesting\n=======\n\n.. code-block:: console\n\n $ make test\n\nOr full tests with TOX:\n\n.. code-block:: console\n\n $ make test-all\n\nLimitations\n===========\n\nIn some very rare cases dotty may not work properly.\n\n* When nested dictionary has two keys of different type, but with the same value.\n In that case dotty will return dict or list under random key with passed value.\n\n* Keys in dictionary may not contain dots. If you need to use dots, please specify dotty with custom separator.\n\n* Nested keys may not be bool type. Bool type keys are only supported when calling keys with type defined value (e.g. dot[True], dot[False]).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Dictionary wrapper for quick access to deeply nested keys.",
"version": "1.3.1",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1a91e0d457ee03ec33d79ee2cd8d212debb1bc21dfb99728ae35efdb5832dc22",
"md5": "0a8b6c90e6f991d4389de72774c5b181",
"sha256": "5022d234d9922f13aa711b4950372a06a6d64cb6d6db9ba43d0ba133ebfce31f"
},
"downloads": -1,
"filename": "dotty_dict-1.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0a8b6c90e6f991d4389de72774c5b181",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5,<4.0",
"size": 7014,
"upload_time": "2022-07-09T18:50:55",
"upload_time_iso_8601": "2022-07-09T18:50:55.058816Z",
"url": "https://files.pythonhosted.org/packages/1a/91/e0d457ee03ec33d79ee2cd8d212debb1bc21dfb99728ae35efdb5832dc22/dotty_dict-1.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6aab88d67f02024700b48cd8232579ad1316aa9df2272c63049c27cc094229d6",
"md5": "062b7927dc2fbbb3b8feff260f939d7d",
"sha256": "4b016e03b8ae265539757a53eba24b9bfda506fb94fbce0bee843c6f05541a15"
},
"downloads": -1,
"filename": "dotty_dict-1.3.1.tar.gz",
"has_sig": false,
"md5_digest": "062b7927dc2fbbb3b8feff260f939d7d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5,<4.0",
"size": 7699,
"upload_time": "2022-07-09T18:50:57",
"upload_time_iso_8601": "2022-07-09T18:50:57.727006Z",
"url": "https://files.pythonhosted.org/packages/6a/ab/88d67f02024700b48cd8232579ad1316aa9df2272c63049c27cc094229d6/dotty_dict-1.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-07-09 18:50:57",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "dotty-dict"
}