{ "info": { "author": "Peter Vrba", "author_email": "phonkee@phonkee.eu", "bugtrack_url": null, "classifiers": [], "description": "Context\n=======\n\n``vcontext`` package provides single object ``Context``. Context is\ndictionary like datastructure with custom access to items. You can\naccess your data by dot access. Context does not wrap data in itself,\nrather just access them. Context has ``data`` attribute where data is\nstored.\n\nInstall\n-------\n\nvcontext is on `pypi `__ so you\ncan simply:\n\n``pip install vcontext``\n\n``__getitem__`` vs ``__getattribute__``\n'''''''''''''''''''''''''''''''''''''''\n\nFor ``Context`` I have decided to use ``__getitem__`` approach, since I\nwanted to have consistent dot access also to lists/tuples. This would be\nimpossible using ``__getattr__``.\n\nItem\n^^^^\n\nItem is dot-separated path to value. This item is splitted and values\nhave following rules \\* string - access to dictionary item or object\nattribute \\* integer - access to list item \\* first part must be string\n(since Context is a dictionary)\n\nExample:\n \n\n.. code:: python\n\n context = Context({\n 'status': 200,\n 'message': 'OK',\n 'result': [\n {\n 'user': {\n 'username': 'phonkee',\n 'name': 'Peter Vrba'\n }\n }\n ]\n })\n assert context['result.0.user.username'] == 'phonkee'\n assert context['status'] == 200\n\nIf the data is not found, ``KeyError`` is raised on part of item that\nwas not found. Context provides ``get`` method where you can specify\ndefault value if value is not found and that will never raise exception.\n\nBuild items:\n------------\n\nContext would be useless if it only supported get of values. Context has\nsupport also to create/delete values on underlying datas by given\n``item``. Lets build a structure from previous example:\n\n.. code:: python\n\n context = Context()\n context['status'] = 200\n context['message'] = 'OK'\n context['result.0.user.username'] = 'phonkee'\n context['result.0.user.name'] = 'Peter Vrba'\n\n assert context.data == {\n 'status': 200,\n 'message': 'OK',\n 'result': [\n {\n 'user': {\n 'username': 'phonkee',\n 'name': 'Peter Vrba'\n }\n }\n ]\n }\n\nNow we try to delete item\n\n.. code:: python\n\n del context['result.0']\n assert len(context['result']) == 0\n\nIsn\u2019t that cute little helper?\n\n.keys(item=None):\n-----------------\n\nContext also supports ``keys`` method. By calling this method context\ntraverses recursively object. It has support for dict/list, for custom\nobject it returns just the object key.\n\n.. code:: python\n\n context = Context()\n context['hello.world'] = 'yay'\n assert context.keys() == ['hello.world']\n\napi:\n----\n\nContext provides following methods:\n\n- ``.copy()`` - deepcopies data and returns new context\n- ``.dumps(item=None)`` - dump to json, attributes:\n\n - item - item to be dumped to json\n\n- ``.items(**kwargs)`` - list of key value items (tuple key, value),\n \\**kwargs passed to ``keys`` method\n- ``.iteritems(**kwargs)`` - generator version of items, \\**kwargs\n passed to ``keys`` method\n- ``keys(item=None)`` - returns list of all keys, attributes:\n\n - item - item to be dumped to json\n\nContribute:\n-----------\n\nContributions are welcome, there are still a lot of parts to be\nenhanced.\n\nTODO:\n-----\n\n- add support for special list key **append** so we can append to list.\n e.g:\n\n.. code:: python\n\n context['result.usernames.__append__'] = 'phonkee'\n\nAuthor\n------\n\nPeter Vrba (phonkee)", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/phonkee/vcontext", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "vcontext", "package_url": "https://pypi.org/project/vcontext/", "platform": "", "project_url": "https://pypi.org/project/vcontext/", "project_urls": { "Homepage": "https://github.com/phonkee/vcontext" }, "release_url": "https://pypi.org/project/vcontext/0.23/", "requires_dist": null, "requires_python": "", "summary": "Context data structure", "version": "0.23" }, "last_serial": 5991024, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "16cb020322fb9dbec34763567b2530f0", "sha256": "1ccdaf08728eb0e74a3a3913b84e004546f83775a5d6805e2ed2bc2a37c34691" }, "downloads": -1, "filename": "vcontext-0.1.tar.gz", "has_sig": false, "md5_digest": "16cb020322fb9dbec34763567b2530f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3427, "upload_time": "2016-01-16T02:46:20", "url": "https://files.pythonhosted.org/packages/08/2a/015460f47c04e7ca6e961a13a9d23be216dcd853398e3c81738d7ff0361c/vcontext-0.1.tar.gz" } ], "0.10": [ { "comment_text": "", "digests": { "md5": "b173a7a9e5cf71ba3e45c7b44736728b", "sha256": "b4ff9a818e81ffca3322be8cf9e1ea019828817d795c6002e11c4e343f50c614" }, "downloads": -1, "filename": "vcontext-0.10.tar.gz", "has_sig": false, "md5_digest": "b173a7a9e5cf71ba3e45c7b44736728b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8854, "upload_time": "2016-04-25T18:15:13", "url": "https://files.pythonhosted.org/packages/15/00/f02774a5ab91d3dbe40802468cdaaccbe0ac349c5f934b8fd456616bdbbb/vcontext-0.10.tar.gz" } ], "0.11": [ { "comment_text": "", "digests": { "md5": "faffc8ae04340650e40aa20abeb66c01", "sha256": "9b7a8c6fce57d63bb11708c9c6526f5dfc0e2337f7db4559f614734c58269265" }, "downloads": -1, "filename": "vcontext-0.11.tar.gz", "has_sig": false, "md5_digest": "faffc8ae04340650e40aa20abeb66c01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8535, "upload_time": "2016-05-01T19:46:30", "url": "https://files.pythonhosted.org/packages/61/7d/b0e1e0621464307df6430eddfe7a7b31185d0b2f3ed42dfc9918505556f4/vcontext-0.11.tar.gz" } ], "0.12": [ { "comment_text": "", "digests": { "md5": "f478f4ae8c6dd3d7f8db8ce81d8675a3", "sha256": "cf6fbd55eb0fff388f158473e9be2c74cdb953cfd741f738fb702cdc6a040c2c" }, "downloads": -1, "filename": "vcontext-0.12.tar.gz", "has_sig": false, "md5_digest": "f478f4ae8c6dd3d7f8db8ce81d8675a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9582, "upload_time": "2016-05-04T14:39:49", "url": "https://files.pythonhosted.org/packages/c7/02/ae35ebf0a516ba16986afccd9c43dd9a1ed7ccc8efba404e256e272190d6/vcontext-0.12.tar.gz" } ], "0.13": [ { "comment_text": "", "digests": { "md5": "71c3c3c359d53cfc90ac92c22c6cfbe8", "sha256": "dfe61782a6a6f2cf4608e434e988efe843c48d0228874666c8e5cbddf8db5d9e" }, "downloads": -1, "filename": "vcontext-0.13.tar.gz", "has_sig": false, "md5_digest": "71c3c3c359d53cfc90ac92c22c6cfbe8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9580, "upload_time": "2016-05-04T14:41:26", "url": "https://files.pythonhosted.org/packages/e6/e4/05b47846b29a4c0c83afbe12630882b0edd5389f258737115c3695b853c0/vcontext-0.13.tar.gz" } ], "0.14": [ { "comment_text": "", "digests": { "md5": "74832e6164078c702e3b4e2ef4f3a2a8", "sha256": "7cdd2bf050efbedc74d93eacb9f66f35731d5fee58003d37e18e46e2dda8ae28" }, "downloads": -1, "filename": "vcontext-0.14.tar.gz", "has_sig": false, "md5_digest": "74832e6164078c702e3b4e2ef4f3a2a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9853, "upload_time": "2016-05-04T14:49:31", "url": "https://files.pythonhosted.org/packages/ed/3f/7d297ea747555843f2ac88329211636d008be573c26681d55fabc17c4e8a/vcontext-0.14.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "2b78dcb82b96d88d49b68f8c283ba396", "sha256": "690f378941ce44040d0473ba96bf22b716b413b4a3c93e69c738f11e2575c3bd" }, "downloads": -1, "filename": "vcontext-0.2.tar.gz", "has_sig": false, "md5_digest": "2b78dcb82b96d88d49b68f8c283ba396", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3613, "upload_time": "2016-01-16T03:07:32", "url": "https://files.pythonhosted.org/packages/29/e5/4ad09a4e639b38a041f895ba747cee1364005e42aa580410a2c3c11c02cd/vcontext-0.2.tar.gz" } ], "0.22": [ { "comment_text": "", "digests": { "md5": "8baa78454195ed69eccedec6d4e4fd5e", "sha256": "2ae1b8fb5f7bf5a1e1a6dfd510c1ee3e5dd7420287b98ea5729286c2d70209af" }, "downloads": -1, "filename": "vcontext-0.22.tar.gz", "has_sig": false, "md5_digest": "8baa78454195ed69eccedec6d4e4fd5e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9616, "upload_time": "2019-09-30T14:31:01", "url": "https://files.pythonhosted.org/packages/80/cc/6381aadf733bce97b15aa0545ab8a688f57b6a1a5af711f4a0e39c1b0401/vcontext-0.22.tar.gz" } ], "0.23": [ { "comment_text": "", "digests": { "md5": "70c2e9fdf12a057598331051bd09cdf0", "sha256": "6823f74826327cd5593a29ded74c76a70f11feb937f62e0841d61c08842e62e9" }, "downloads": -1, "filename": "vcontext-0.23.tar.gz", "has_sig": false, "md5_digest": "70c2e9fdf12a057598331051bd09cdf0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9610, "upload_time": "2019-10-17T15:57:28", "url": "https://files.pythonhosted.org/packages/dd/41/017447d076dd401302dc50a91d28d5b3ed3d78cc269bbe0924c6a3fde848/vcontext-0.23.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "5ba293fabb443701168246db0c1107a0", "sha256": "0c61a46a56026fdf814a9469639b0574629e15cee7435d7f469b8c8e9c39f464" }, "downloads": -1, "filename": "vcontext-0.3.tar.gz", "has_sig": false, "md5_digest": "5ba293fabb443701168246db0c1107a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3786, "upload_time": "2016-01-16T03:38:30", "url": "https://files.pythonhosted.org/packages/5a/68/a245bfb19a4d9702693c917e4c6290d0c0783e0841fbf2eb5dc7c4b8059c/vcontext-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "a7f9ae302bb65c78b5485ef8ce22fabd", "sha256": "5d2e70a1b5cc51ee935ae5fbe843963eb0768c64b0f75d3144a473b4db6dcb08" }, "downloads": -1, "filename": "vcontext-0.4.tar.gz", "has_sig": false, "md5_digest": "a7f9ae302bb65c78b5485ef8ce22fabd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3749, "upload_time": "2016-01-16T03:44:59", "url": "https://files.pythonhosted.org/packages/e4/71/409a4249a7f470246c68a9fd508e39b81ab975ac0b2f2527e222002f0078/vcontext-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "bfbf665d575ce98e31add9826ccb1e27", "sha256": "bbd607a72488ddbf4548b6525f06dd7c0cd197d19249826a1dc49408b16d060f" }, "downloads": -1, "filename": "vcontext-0.5.tar.gz", "has_sig": false, "md5_digest": "bfbf665d575ce98e31add9826ccb1e27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4343, "upload_time": "2016-01-20T15:56:20", "url": "https://files.pythonhosted.org/packages/45/be/5f6cbcf2ff00060899293e4f3132cfb6faeab76697dbbc86c4a3f5f382d7/vcontext-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "cd4efec4a41cd6f6018427e5febe0733", "sha256": "85a4a8a21e0bcef110646052de439cd1febd8d62137ae038f801961d44a1cf54" }, "downloads": -1, "filename": "vcontext-0.5.1.tar.gz", "has_sig": false, "md5_digest": "cd4efec4a41cd6f6018427e5febe0733", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4357, "upload_time": "2016-01-20T15:58:34", "url": "https://files.pythonhosted.org/packages/37/b0/9ef8ee54ce774defd12639a11e33b6505a23d8cbbfc814b773fd3fd9bd23/vcontext-0.5.1.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "3ccfba78ab66762a1d0fe965713300fa", "sha256": "76e111f7385d8ed6179b90949df3131dba1ca9be5e8122ff82152e22173d37b2" }, "downloads": -1, "filename": "vcontext-0.6.tar.gz", "has_sig": false, "md5_digest": "3ccfba78ab66762a1d0fe965713300fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4355, "upload_time": "2016-01-20T15:59:42", "url": "https://files.pythonhosted.org/packages/b8/d3/0b009c1aa31073fffe9ecf71b71aa210ad358f1a37f777b5f9d319b01489/vcontext-0.6.tar.gz" } ], "0.7": [ { "comment_text": "", "digests": { "md5": "181f17248143560ce49672f39be47d1e", "sha256": "a45aa8fcc4f528cca83b1362555355bd3997c0d43375f94d3c7886cd44bb6940" }, "downloads": -1, "filename": "vcontext-0.7.tar.gz", "has_sig": false, "md5_digest": "181f17248143560ce49672f39be47d1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5340, "upload_time": "2016-01-26T15:16:34", "url": "https://files.pythonhosted.org/packages/45/9d/7f7d5bb03b58a79b0f8edfa922c40c1e542c972b3f0f11d608096617a19d/vcontext-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "7bf119a08ef626db5adfc033aa837032", "sha256": "b8bd381805f61aee3619eb85f0a4dbd6ddfa29d2b4bea4226098d6dc37e08c4e" }, "downloads": -1, "filename": "vcontext-0.8.tar.gz", "has_sig": false, "md5_digest": "7bf119a08ef626db5adfc033aa837032", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6770, "upload_time": "2016-02-02T00:14:29", "url": "https://files.pythonhosted.org/packages/aa/bf/bf9a4e4e1edd293346b97a2da0481439644f746fb446af062025039d9d4c/vcontext-0.8.tar.gz" } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "dfa8e437e8845dbe2607b6c9c1cc6d71", "sha256": "d8b09324a3f66ba4c4378cb8a5414ca77fff35d16c0ffae57645240490faec1c" }, "downloads": -1, "filename": "vcontext-0.8.1.tar.gz", "has_sig": false, "md5_digest": "dfa8e437e8845dbe2607b6c9c1cc6d71", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6796, "upload_time": "2016-02-02T01:45:02", "url": "https://files.pythonhosted.org/packages/34/2c/4f686203ca4828d07daaf4d8e33a8fc7e2f7b10e253449af5d9e8facf5dd/vcontext-0.8.1.tar.gz" } ], "0.8.2": [ { "comment_text": "", "digests": { "md5": "99a1de281d21e60ca7cb4d6007c3e0ed", "sha256": "54148faa63de500134811e01eff642829bb3740ca15cda219ea44d715bda48ea" }, "downloads": -1, "filename": "vcontext-0.8.2.tar.gz", "has_sig": false, "md5_digest": "99a1de281d21e60ca7cb4d6007c3e0ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6918, "upload_time": "2016-02-02T02:38:23", "url": "https://files.pythonhosted.org/packages/da/98/eb807174046155b628df5099cb5cb4f73208f464d2bfe26cacc78fb23d6f/vcontext-0.8.2.tar.gz" } ], "0.9": [ { "comment_text": "", "digests": { "md5": "c875bb217e190ca02b13206488519850", "sha256": "ce70a8ce944194ee5dc56709b3c9b9a20fe799fa904904f63fa4ec8f77fa1163" }, "downloads": -1, "filename": "vcontext-0.9.tar.gz", "has_sig": false, "md5_digest": "c875bb217e190ca02b13206488519850", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6914, "upload_time": "2016-02-02T16:02:18", "url": "https://files.pythonhosted.org/packages/e9/69/ddb57f623279639d496bb0c4eaeadd7aafe315f0308ab6d6a42246abd446/vcontext-0.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "70c2e9fdf12a057598331051bd09cdf0", "sha256": "6823f74826327cd5593a29ded74c76a70f11feb937f62e0841d61c08842e62e9" }, "downloads": -1, "filename": "vcontext-0.23.tar.gz", "has_sig": false, "md5_digest": "70c2e9fdf12a057598331051bd09cdf0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9610, "upload_time": "2019-10-17T15:57:28", "url": "https://files.pythonhosted.org/packages/dd/41/017447d076dd401302dc50a91d28d5b3ed3d78cc269bbe0924c6a3fde848/vcontext-0.23.tar.gz" } ] }