{ "info": { "author": "Rotem Yaari", "author_email": "vmalloc@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development", "Topic :: Software Development :: Libraries", "Topic :: Utilities" ], "description": "[![Build Status](https://travis-ci.org/Infinidat/munch.svg?branch=master)](https://travis-ci.org/Infinidat/munch)\n[![Latest Version](https://img.shields.io/pypi/v/munch.svg)](https://pypi.python.org/pypi/munch/)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/munch.svg)](https://pypi.python.org/pypi/munch/)\n[![Downloads](https://img.shields.io/pypi/dm/munch.svg)](https://pypi.python.org/pypi/munch/)\n\nmunch\n==========\n\nmunch is a fork of David Schoonover's **Bunch** package, providing similar functionality. 99% of the work was done by him, and the fork was made mainly for lack of responsiveness for fixes and maintenance on the original code.\n\nMunch is a dictionary that supports attribute-style access, a la JavaScript:\n\n```python\n\n>>> b = Munch()\n>>> b.hello = 'world'\n>>> b.hello\n'world'\n>>> b['hello'] += \"!\"\n>>> b.hello\n'world!'\n>>> b.foo = Munch(lol=True)\n>>> b.foo.lol\nTrue\n>>> b.foo is b['foo']\nTrue\n\n```\n\n\nDictionary Methods\n------------------\n\nA Munch is a subclass of ``dict``; it supports all the methods a ``dict`` does:\n\n```python\n\n>>> list(b.keys())\n['hello', 'foo']\n\n```\n\nIncluding ``update()``:\n\n```python\n\n>>> b.update({ 'ponies': 'are pretty!' }, hello=42)\n>>> print(repr(b))\nMunch({'hello': 42, 'foo': Munch({'lol': True}), 'ponies': 'are pretty!'})\n\n```\n\nAs well as iteration:\n\n```python\n\n>>> [ (k,b[k]) for k in b ]\n[('hello', 42), ('foo', Munch({'lol': True})), ('ponies', 'are pretty!')]\n\n```\n\nAnd \"splats\":\n\n```python\n\n>>> \"The {knights} who say {ni}!\".format(**Munch(knights='lolcats', ni='can haz'))\n'The lolcats who say can haz!'\n\n```\n\n\nSerialization\n-------------\n\nMunches happily and transparently serialize to JSON and YAML.\n\n```python\n\n>>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!')\n>>> import json\n>>> json.dumps(b)\n'{\"foo\": {\"lol\": true}, \"hello\": 42, \"ponies\": \"are pretty!\"}'\n\n```\n\nIf JSON support is present (``json`` or ``simplejson``), ``Munch`` will have a ``toJSON()`` method which returns the object as a JSON string.\n\nIf you have [PyYAML](http://pyyaml.org/wiki/PyYAML) installed, Munch attempts to register itself with the various YAML Representers so that Munches can be transparently dumped and loaded.\n\n```python\n\n>>> b = Munch(foo=Munch(lol=True), hello=42, ponies='are pretty!')\n>>> import yaml\n>>> yaml.dump(b)\n'!munch.Munch\\nfoo: !munch.Munch\\n lol: true\\nhello: 42\\nponies: are pretty!\\n'\n>>> yaml.safe_dump(b)\n'foo:\\n lol: true\\nhello: 42\\nponies: are pretty!\\n'\n\n```\n\nIn addition, Munch instances will have a ``toYAML()`` method that returns the YAML string using ``yaml.safe_dump()``. This method also replaces ``__str__`` if present, as I find it far more readable. You can revert back to Python's default use of ``__repr__`` with a simple assignment: ``Munch.__str__ = Munch.__repr__``. The Munch class will also have a static method ``Munch.fromYAML()``, which loads a Munch out of a YAML string.\n\nFinally, Munch converts easily and recursively to (``unmunchify()``, ``Munch.toDict()``) and from (``munchify()``, ``Munch.fromDict()``) a normal ``dict``, making it easy to cleanly serialize them in other formats.\n\n\nDefault Values\n--------------\n\n``DefaultMunch`` instances return a specific default value when an attribute is missing from the collection. Like ``collections.defaultdict``, the first argument is the value to use for missing keys:\n\n```python\n\n>>> undefined = object()\n>>> b = DefaultMunch(undefined, {'hello': 'world!'})\n>>> b.hello\n'world!'\n>>> b.foo is undefined\nTrue\n\n```\n\n``DefaultMunch.fromDict()`` also takes the ``default`` argument:\n\n```python\n\n>>> undefined = object()\n>>> b = DefaultMunch.fromDict({'recursively': {'nested': 'value'}}, undefined)\n>>> b.recursively.nested == 'value'\nTrue\n>>> b.recursively.foo is undefined\nTrue\n\n```\n\nOr you can use ``DefaultFactoryMunch`` to specify a factory for generating missing attributes. The first argument is the factory:\n\n```python\n\n>>> b = DefaultFactoryMunch(list, {'hello': 'world!'})\n>>> b.hello\n'world!'\n>>> b.foo\n[]\n>>> b.bar.append('hello')\n>>> b.bar\n['hello']\n\n```\n\n\nMiscellaneous\n-------------\n\n* It is safe to ``import *`` from this module. You'll get: ``Munch``, ``DefaultMunch``, ``DefaultFactoryMunch``, ``munchify`` and ``unmunchify``.\n* Ample Tests. Just run ``pip install tox && tox`` from the project root.\n\nFeedback\n--------\n\nOpen a ticket / fork the project on [GitHub](http://github.com/Infinidat/munch).\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Infinidat/munch", "keywords": "munch,dict,mapping,container,collection", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "munch", "package_url": "https://pypi.org/project/munch/", "platform": "", "project_url": "https://pypi.org/project/munch/", "project_urls": { "Homepage": "https://github.com/Infinidat/munch" }, "release_url": "https://pypi.org/project/munch/2.5.0/", "requires_dist": [ "six", "pytest ; extra == 'testing'", "coverage ; extra == 'testing'", "astroid (~=1.5.3) ; (python_version == \"2.7\") and extra == 'testing'", "pylint (~=1.7.2) ; (python_version == \"2.7\") and extra == 'testing'", "astroid (>=2.0) ; (python_version >= \"3.4\") and extra == 'testing'", "pylint (~=2.3.1) ; (python_version >= \"3.4\") and extra == 'testing'", "PyYAML (>=5.1.0) ; extra == 'yaml'" ], "requires_python": "", "summary": "A dot-accessible dictionary (a la JavaScript objects)", "version": "2.5.0", "yanked": false, "yanked_reason": null }, "last_serial": 6778228, "releases": { "2.0.0": [], "2.0.1": [ { "comment_text": "", "digests": { "md5": "18ad3a59dff4d8734fed15b578d48d21", "sha256": "91f81bb4562f8abf432e3378bc7ef6ee7c1d767316c937c256f4647871b9b495" }, "downloads": -1, "filename": "munch-2.0.1.tar.gz", "has_sig": false, "md5_digest": "18ad3a59dff4d8734fed15b578d48d21", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6658, "upload_time": "2014-01-16T12:59:10", "upload_time_iso_8601": "2014-01-16T12:59:10.513791Z", "url": "https://files.pythonhosted.org/packages/8d/07/e218828a6f123941dc6714cddb7e7eabf891871fc835bc84577501aacfec/munch-2.0.1.tar.gz", "yanked": false, "yanked_reason": null } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "6bff44f4f33b0af4f6f991a996f5a314", "sha256": "68fd192e64a22a69d445a74d84da640cb2314e9571114836864a7b5c06d1454d" }, "downloads": -1, "filename": "munch-2.0.2.tar.gz", "has_sig": false, "md5_digest": "6bff44f4f33b0af4f6f991a996f5a314", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6898, "upload_time": "2014-01-16T13:08:00", "upload_time_iso_8601": "2014-01-16T13:08:00.612022Z", "url": "https://files.pythonhosted.org/packages/a7/c5/bceaf43f9c9c40ff94adc9caa1933bb0fead68568745cbc2a36d762be378/munch-2.0.2.tar.gz", "yanked": false, "yanked_reason": null } ], "2.0.3": [ { "comment_text": "", "digests": { "md5": "50fcbbe8b98a256cf0d65280f20e3720", "sha256": "c06570a2b27b6f3c2052a0df999130bfc782f0fa004bfbcaa44623c8d3e8e925" }, "downloads": -1, "filename": "munch-2.0.3.tar.gz", "has_sig": false, "md5_digest": "50fcbbe8b98a256cf0d65280f20e3720", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7122, "upload_time": "2015-10-02T19:24:49", "upload_time_iso_8601": "2015-10-02T19:24:49.903173Z", "url": "https://files.pythonhosted.org/packages/74/30/bb14b8832db44989f3cda7a933cc037adf1c937fbe22cfbfb75b46d2a306/munch-2.0.3.tar.gz", "yanked": false, "yanked_reason": null } ], "2.0.4": [ { "comment_text": "", "digests": { "md5": "6fd6f748f5698c756e143f2be847d449", "sha256": "1420683a94f3a2ffc77935ddd28aa9ccb540dd02b75e02ed7ea863db437ab8b2" }, "downloads": -1, "filename": "munch-2.0.4.tar.gz", "has_sig": false, "md5_digest": "6fd6f748f5698c756e143f2be847d449", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6858, "upload_time": "2015-11-03T15:21:32", "upload_time_iso_8601": "2015-11-03T15:21:32.427070Z", "url": "https://files.pythonhosted.org/packages/06/df/f8c11e662c80741240e48b701c6ee81723ecc6a4f81db63c664428d6f4da/munch-2.0.4.tar.gz", "yanked": false, "yanked_reason": null } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "5e18d089bd6f149a5af8b75cea8b1fbd", "sha256": "b7cc5c5e25b0de16dda314b4054dcd9b9b6e72740b1bf3f54814b40fd83c46c9" }, "downloads": -1, "filename": "munch-2.1.0.tar.gz", "has_sig": false, "md5_digest": "5e18d089bd6f149a5af8b75cea8b1fbd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6679, "upload_time": "2017-01-10T13:19:03", "upload_time_iso_8601": "2017-01-10T13:19:03.080835Z", "url": "https://files.pythonhosted.org/packages/9d/0e/b2f9d2171182a521e90fe077c924ced5cfdea42efb1fe8c394a1b6fd7511/munch-2.1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "c25c3d4364f3ece0d20cb4df102a8c36", "sha256": "648b650d1eb0173bd83c29f2eea2568b7591c1e05c87971387d170c71c6397e8" }, "downloads": -1, "filename": "munch-2.1.1.tar.gz", "has_sig": false, "md5_digest": "c25c3d4364f3ece0d20cb4df102a8c36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6565, "upload_time": "2017-03-20T09:17:12", "upload_time_iso_8601": "2017-03-20T09:17:12.634144Z", "url": "https://files.pythonhosted.org/packages/84/dc/d897cb427f15029e04745a3de611d8ed3d97e9a0ef894547a0ba261f2807/munch-2.1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "2.2.0": [ { "comment_text": "", "digests": { "md5": "682e1ac873daa78eb8c9fb4f006893b7", "sha256": "62fb4fb318e965a464b088e6af52a63e0905a50500b770596a939d3855e7aa15" }, "downloads": -1, "filename": "munch-2.2.0.tar.gz", "has_sig": false, "md5_digest": "682e1ac873daa78eb8c9fb4f006893b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7108, "upload_time": "2017-07-27T10:07:59", "upload_time_iso_8601": "2017-07-27T10:07:59.183830Z", "url": "https://files.pythonhosted.org/packages/92/58/c17cf679a2b9b65541cc71ba13a950289b7d34dd0967e34b8816a4d87044/munch-2.2.0.tar.gz", "yanked": false, "yanked_reason": null } ], "2.3.0": [ { "comment_text": "", "digests": { "md5": "044704a9c226743c34d17b2e841be482", "sha256": "fb641b9a1889629edc720427e2e1516fa1407f1d9a08ce489007c9a8a69ff16e" }, "downloads": -1, "filename": "munch-2.3.0.tar.gz", "has_sig": false, "md5_digest": "044704a9c226743c34d17b2e841be482", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7554, "upload_time": "2018-04-09T10:27:33", "upload_time_iso_8601": "2018-04-09T10:27:33.451633Z", "url": "https://files.pythonhosted.org/packages/2c/bf/0e810b28327400617a388217e78bf1d5deccb69e3896fb81034a007c5f2a/munch-2.3.0.tar.gz", "yanked": false, "yanked_reason": null } ], "2.3.1": [ { "comment_text": "", "digests": { "md5": "1c45240e87b2651b1ff1faae15d77fe3", "sha256": "fc64a4aeb47e34ff1125f69af3cf3f59e51554b96dbaa2b720c6fb6c9e47a551" }, "downloads": -1, "filename": "munch-2.3.1.tar.gz", "has_sig": false, "md5_digest": "1c45240e87b2651b1ff1faae15d77fe3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7566, "upload_time": "2018-04-11T07:12:19", "upload_time_iso_8601": "2018-04-11T07:12:19.796488Z", "url": "https://files.pythonhosted.org/packages/64/4e/ab05b4a03fe1221e54f1c2040c2375180759c5931dbe21da955f467f5b6b/munch-2.3.1.tar.gz", "yanked": false, "yanked_reason": null } ], "2.3.2": [ { "comment_text": "", "digests": { "md5": "539311fdfc6419381b6f38d0695f01ee", "sha256": "6ae3d26b837feacf732fb8aa5b842130da1daf221f5af9f9d4b2a0a6414b0d51" }, "downloads": -1, "filename": "munch-2.3.2.tar.gz", "has_sig": false, "md5_digest": "539311fdfc6419381b6f38d0695f01ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7598, "upload_time": "2018-05-06T06:41:32", "upload_time_iso_8601": "2018-05-06T06:41:32.677549Z", "url": "https://files.pythonhosted.org/packages/68/f4/260ec98ea840757a0da09e0ed8135333d59b8dfebe9752a365b04857660a/munch-2.3.2.tar.gz", "yanked": false, "yanked_reason": null } ], "2.4.0": [ { "comment_text": "", "digests": { "md5": "a48b18f2bececb35c6f4c5939e6179e3", "sha256": "86b40da78928972aea73f93968e63fbd7c76a87a810d809a123fd34def6fc0d3" }, "downloads": -1, "filename": "munch-2.4.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a48b18f2bececb35c6f4c5939e6179e3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10243, "upload_time": "2019-10-29T12:05:08", "upload_time_iso_8601": "2019-10-29T12:05:08.618784Z", "url": "https://files.pythonhosted.org/packages/f7/12/c68023fcb8a2f3acd34b310636a921a03436ebf81df6c17231d09996c051/munch-2.4.0-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "119eaa7e33f1c21135287624ee82b4b5", "sha256": "16ffb7e93cdb18a51fc564b4582b9a78579590638dcbda424bc894ee2ea4f741" }, "downloads": -1, "filename": "munch-2.4.0.tar.gz", "has_sig": false, "md5_digest": "119eaa7e33f1c21135287624ee82b4b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16471, "upload_time": "2019-10-29T12:05:10", "upload_time_iso_8601": "2019-10-29T12:05:10.205567Z", "url": "https://files.pythonhosted.org/packages/d7/2e/242a1eaa187b323652569a04fbb06481ef9a46bf8f3643110fb7ae8475e6/munch-2.4.0.tar.gz", "yanked": false, "yanked_reason": null } ], "2.5.0": [ { "comment_text": "", "digests": { "md5": "b45ad9007e5abf23c303adee27ffd27e", "sha256": "6f44af89a2ce4ed04ff8de41f70b226b984db10a91dcc7b9ac2efc1c77022fdd" }, "downloads": -1, "filename": "munch-2.5.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b45ad9007e5abf23c303adee27ffd27e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10347, "upload_time": "2019-10-30T09:56:06", "upload_time_iso_8601": "2019-10-30T09:56:06.835708Z", "url": "https://files.pythonhosted.org/packages/cc/ab/85d8da5c9a45e072301beb37ad7f833cd344e04c817d97e0cc75681d248f/munch-2.5.0-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "ed84c3718416c8d4d03d0a6ef46e8e0c", "sha256": "2d735f6f24d4dba3417fa448cae40c6e896ec1fdab6cdb5e6510999758a4dbd2" }, "downloads": -1, "filename": "munch-2.5.0.tar.gz", "has_sig": false, "md5_digest": "ed84c3718416c8d4d03d0a6ef46e8e0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17015, "upload_time": "2019-10-30T09:56:08", "upload_time_iso_8601": "2019-10-30T09:56:08.621281Z", "url": "https://files.pythonhosted.org/packages/43/a1/ec48010724eedfe2add68eb7592a0d238590e14e08b95a4ffb3c7b2f0808/munch-2.5.0.tar.gz", "yanked": false, "yanked_reason": null } ], "2.5.1.dev12": [ { "comment_text": "", "digests": { "md5": "524ee72b3ff8d1164aac38b81376e684", "sha256": "8fdb6c5cb8ea62611424ed71b4aa896851c6c53952872cbb7d6767dc34119e89" }, "downloads": -1, "filename": "munch-2.5.1.dev12-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "524ee72b3ff8d1164aac38b81376e684", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10579, "upload_time": "2020-03-09T16:20:42", "upload_time_iso_8601": "2020-03-09T16:20:42.414779Z", "url": "https://files.pythonhosted.org/packages/50/7b/836527eb54b0c3513d4bf4a80a72190ea5c630fd8da8a6a0773ac60e8499/munch-2.5.1.dev12-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "67f0bc46ea42275b43312030ce5355f6", "sha256": "b15f80b3ca99b9af0048215f9c81e718fdc6b2accecbcff573d12cddc90fd8c3" }, "downloads": -1, "filename": "munch-2.5.1.dev12.tar.gz", "has_sig": false, "md5_digest": "67f0bc46ea42275b43312030ce5355f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17313, "upload_time": "2020-03-09T16:20:44", "upload_time_iso_8601": "2020-03-09T16:20:44.078265Z", "url": "https://files.pythonhosted.org/packages/b1/97/5a0ff179f193dfb3b86c9e8e192c1251c4701db9572dd21f6f812d76399d/munch-2.5.1.dev12.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b45ad9007e5abf23c303adee27ffd27e", "sha256": "6f44af89a2ce4ed04ff8de41f70b226b984db10a91dcc7b9ac2efc1c77022fdd" }, "downloads": -1, "filename": "munch-2.5.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b45ad9007e5abf23c303adee27ffd27e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10347, "upload_time": "2019-10-30T09:56:06", "upload_time_iso_8601": "2019-10-30T09:56:06.835708Z", "url": "https://files.pythonhosted.org/packages/cc/ab/85d8da5c9a45e072301beb37ad7f833cd344e04c817d97e0cc75681d248f/munch-2.5.0-py2.py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "ed84c3718416c8d4d03d0a6ef46e8e0c", "sha256": "2d735f6f24d4dba3417fa448cae40c6e896ec1fdab6cdb5e6510999758a4dbd2" }, "downloads": -1, "filename": "munch-2.5.0.tar.gz", "has_sig": false, "md5_digest": "ed84c3718416c8d4d03d0a6ef46e8e0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17015, "upload_time": "2019-10-30T09:56:08", "upload_time_iso_8601": "2019-10-30T09:56:08.621281Z", "url": "https://files.pythonhosted.org/packages/43/a1/ec48010724eedfe2add68eb7592a0d238590e14e08b95a4ffb3c7b2f0808/munch-2.5.0.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }