FlatDict
========
|Version| |Status| |Coverage| |License|
``FlatDict`` and ``FlatterDict`` are a dict classes that allows for single level,
delimited key/value pair mapping of nested dictionaries. You can interact with
``FlatDict`` and ``FlatterDict`` like a normal dictionary and access child
dictionaries as you normally would or with the composite key.
*For example:*
.. code-block:: python
value = flatdict.FlatDict({'foo': {'bar': 'baz', 'qux': 'corge'}})
*would be the same as:*
.. code-block:: python
value == {'foo:bar': 'baz', 'foo:qux': 'corge'}
*values can be accessed as:*
.. code-block:: python
print(foo['foo:bar'])
# or
print(foo['foo']['bar'])
Additionally, lists and tuples are also converted into dicts using ``enumerate()``,
using the ``FlatterDict`` class.
*For example:*
.. code-block:: python
value = flatdict.FlatterDict({'list': ['a', 'b', 'c']})
*will be the same as:*
.. code-block:: python
value == {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}
API
---
Documentation is available at https://flatdict.readthedocs.io
Versioning
----------
This package attempts to use semantic versioning. API changes are indicated
by the major version, non-breaking improvements by the minor, and bug fixes
in the revision.
It is recommended that you pin your targets to greater or equal to the current
version and less than the next major version.
Installation
------------
.. code-block:: bash
$ pip install flatdict
Note that as of 4.0, setuptools 39.2 or higher is required for installation.
.. |Version| image:: https://img.shields.io/pypi/v/flatdict.svg?
:target: https://pypi.python.org/pypi/flatdict
.. |Status| image:: https://github.com/gmr/flatdict/workflows/Testing/badge.svg
:target: https://github.com/gmr/flatdict/actions
:alt: Build Status
.. |Coverage| image:: https://img.shields.io/codecov/c/github/gmr/flatdict.svg?
:target: https://codecov.io/github/gmr/flatdict?branch=master
.. |License| image:: https://img.shields.io/pypi/l/flatdict.svg?
:target: https://flatdict.readthedocs.org
Raw data
{
"_id": null,
"home_page": "https://github.com/gmr/flatdict",
"name": "flatdict",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Gavin M. Roy",
"author_email": "gavinmroy@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/3e/0d/424de6e5612f1399ff69bf86500d6a62ff0a4843979701ae97f120c7f1fe/flatdict-4.0.1.tar.gz",
"platform": "",
"description": "FlatDict\n========\n\n|Version| |Status| |Coverage| |License|\n\n``FlatDict`` and ``FlatterDict`` are a dict classes that allows for single level,\ndelimited key/value pair mapping of nested dictionaries. You can interact with\n``FlatDict`` and ``FlatterDict`` like a normal dictionary and access child\ndictionaries as you normally would or with the composite key.\n\n*For example:*\n\n.. code-block:: python\n\n value = flatdict.FlatDict({'foo': {'bar': 'baz', 'qux': 'corge'}})\n\n*would be the same as:*\n\n.. code-block:: python\n\n value == {'foo:bar': 'baz', 'foo:qux': 'corge'}\n\n*values can be accessed as:*\n\n.. code-block:: python\n\n print(foo['foo:bar'])\n\n # or\n\n print(foo['foo']['bar'])\n\nAdditionally, lists and tuples are also converted into dicts using ``enumerate()``,\nusing the ``FlatterDict`` class.\n\n*For example:*\n\n.. code-block:: python\n\n value = flatdict.FlatterDict({'list': ['a', 'b', 'c']})\n\n*will be the same as:*\n\n.. code-block:: python\n\n value == {'list:0': 'a', 'list:1': 'b', 'list:2': 'c'}\n\nAPI\n---\n\nDocumentation is available at https://flatdict.readthedocs.io\n\nVersioning\n----------\nThis package attempts to use semantic versioning. API changes are indicated\nby the major version, non-breaking improvements by the minor, and bug fixes\nin the revision.\n\nIt is recommended that you pin your targets to greater or equal to the current\nversion and less than the next major version.\n\nInstallation\n------------\n\n.. code-block:: bash\n\n $ pip install flatdict\n\nNote that as of 4.0, setuptools 39.2 or higher is required for installation.\n\n.. |Version| image:: https://img.shields.io/pypi/v/flatdict.svg?\n :target: https://pypi.python.org/pypi/flatdict\n\n.. |Status| image:: https://github.com/gmr/flatdict/workflows/Testing/badge.svg\n :target: https://github.com/gmr/flatdict/actions\n :alt: Build Status\n\n.. |Coverage| image:: https://img.shields.io/codecov/c/github/gmr/flatdict.svg?\n :target: https://codecov.io/github/gmr/flatdict?branch=master\n\n.. |License| image:: https://img.shields.io/pypi/l/flatdict.svg?\n :target: https://flatdict.readthedocs.org",
"bugtrack_url": null,
"license": "BSD 3-Clause License",
"summary": "Python module for interacting with nested dicts as a single level dict with delimited keys.",
"version": "4.0.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "a6730f1d70c9ebafe6da495a53b7fad6",
"sha256": "cd32f08fd31ed21eb09ebc76f06b6bd12046a24f77beb1fd0281917e47f26742"
},
"downloads": -1,
"filename": "flatdict-4.0.1.tar.gz",
"has_sig": false,
"md5_digest": "a6730f1d70c9ebafe6da495a53b7fad6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8341,
"upload_time": "2020-02-13T19:16:14",
"upload_time_iso_8601": "2020-02-13T19:16:14.300444Z",
"url": "https://files.pythonhosted.org/packages/3e/0d/424de6e5612f1399ff69bf86500d6a62ff0a4843979701ae97f120c7f1fe/flatdict-4.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2020-02-13 19:16:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "gmr",
"github_project": "flatdict",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "flatdict"
}