{ "info": { "author": "Akiva Miura", "author_email": "akiva.miura@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Utilities" ], "description": "# pycedar\n\n![version](https://img.shields.io/pypi/v/pycedar.svg)\n![python](https://img.shields.io/pypi/pyversions/pycedar.svg)\n![license](https://img.shields.io/pypi/l/pycedar.svg)\n\nPython binding of ``cedar`` (implementation of efficiently-updatable double-array trie) using Cython\n\nOfficial URL of ``cedar``: http://www.tkl.iis.u-tokyo.ac.jp/~ynaga/cedar/\n\n## Installation\n\n### install from PyPi release\n\n```shell\n$ pip install --user pycedar\n```\n\n### install from GitHub master\n\n```shell\n$ pip install --user https://github.com/akivajp/pycedar/archive/master.zip\n```\n\n## Usage\n\n### using python-like dict class based on double array trie\n\n```python\n>>> import pycedar\n\n>>> d = pycedar.dict()\n>>> print( len(d) )\n0\n>>> print( bool(d) )\nFalse\n>>> print( list(d) )\n[]\n\n>>> d['nineteen'] = 19\n>>> d.set('twenty', 20)\n>>> d['twenty one'] = 21\n>>> d['twenty two'] = 22\n>>> d['twenty three'] = 23\n>>> d['twenty four'] = 24\n\n>>> print( len(d) )\n6\n>>> print( bool(d) )\nTrue\n>>> print( list(d) )\n['nineteen', 'twenty', 'twenty four', 'twenty one', 'twenty three', 'twenty two']\n>>> print( list(d.keys()) )\n['nineteen', 'twenty', 'twenty four', 'twenty one', 'twenty three', 'twenty two']\n>>> print( list(d.values()) )\n[19, 20, 24, 21, 23, 22]\n>>> print( list(d.items()) )\n[('nineteen', 19), ('twenty', 20), ('twenty four', 24), ('twenty one', 21), ('twenty three', 23), ('twenty two', 22)]\n>>> print( d['twenty four'] )\n24\n>>> print( 'twenty four' in d )\nTrue\n>>> del d['twenty four']\n>>> print( 'twenty four' in d )\nFalse\n>>> try:\n>>> print( d['twenty four'] )\n>>> except Exception as e:\n>>> print( repr(e) )\nKeyError('twenty four',)\n>>> print( d.get('twenty three') )\n23\n>>> print( d.get('twenty four') )\n-1\n>>> print( d.get('twenty four', None) )\nNone\n\n>>> print( list(d.find('')) )\n[('nineteen', 19), ('twenty', 20), ('twenty one', 21), ('twenty three', 23), ('twenty two', 22)]\n>>> print( list(d.find('tw')) )\n[('twenty', 20), ('twenty one', 21), ('twenty three', 23), ('twenty two', 22)]\n>>> print( list(d.find('twenty t')) )\n[('twenty three', 23), ('twenty two', 22)]\n>>> print( list(d.find_keys('twenty')) )\n['twenty', 'twenty one', 'twenty three', 'twenty two']\n>>> print( list(d.find_values('twenty')) )\n[20, 21, 23, 22]\n\n>>> n = d.get_node('twenty')\n>>> print( n )\n'twenty'\n>>> print( repr(n) )\npycedar.node(trie=, id=260, length=6, root=0)\n>>> print( n.key() )\ntwenty\n>>> print( n.value() )\n20\n>>> print( [n.key() for n in n.find_nodes(' t')] )\n[' three', ' two']\n\n>>> n = d.get_node('twenty ')\n>>> print( n )\nNone\n\n>>> d.save('test.dat')\n>>> d2 = pycedar.dict()\n>>> print( d2.setdefault('eighteen', 18) )\n18\n>>> print( list(d2.items()) )\n[('eighteen', 18)]\n>>> d2.load('test.dat')\n>>> print( list(d2.items()) )\n[('nineteen', 19), ('twenty', 20), ('twenty one', 21), ('twenty three', 23), ('twenty two', 22)]\n>>> print( d2.setdefault('eighteen', 18) )\n18\n>>> print( list(d2.items()) )\n[('eighteen', 18), ('nineteen', 19), ('twenty', 20), ('twenty one', 21), ('twenty three', 23), ('twenty two', 22)]\n```\n\n### using more primitive data structures\n\n(TBA)\n\n### todo\n\n* documentation of classes:\n * base_trie\n * str_trie\n * bytes_trie\n * unicode_trie\n * node", "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/akivajp/pycedar", "keywords": "", "license": "GPLv2, GPLv2.1 and BSD", "maintainer": "", "maintainer_email": "", "name": "pycedar", "package_url": "https://pypi.org/project/pycedar/", "platform": "", "project_url": "https://pypi.org/project/pycedar/", "project_urls": { "Homepage": "https://github.com/akivajp/pycedar" }, "release_url": "https://pypi.org/project/pycedar/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Python binding of cedar (implementation of efficiently-updatable double-array trie) using Cython", "version": "0.1.1" }, "last_serial": 4744216, "releases": { "0.0.4": [ { "comment_text": "", "digests": { "md5": "0f5d1e8612a38f1879ca3086e9f9668d", "sha256": "35d8599cd433fcac4b7e255daef55c3920dad7d3e867740be493697d38d746fc" }, "downloads": -1, "filename": "pycedar-0.0.4-cp27-cp27m-macosx_10_12_x86_64.whl", "has_sig": false, "md5_digest": "0f5d1e8612a38f1879ca3086e9f9668d", "packagetype": "bdist_wheel", "python_version": "cp27", "requires_python": null, "size": 152980, "upload_time": "2018-08-05T21:43:13", "url": "https://files.pythonhosted.org/packages/f6/af/70346df5de9b15e8bc6296f7f557b016e2458781575b3c0e4137ba4858d6/pycedar-0.0.4-cp27-cp27m-macosx_10_12_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "d5eb2dc0585619ed9533f2f16945a5da", "sha256": "53a46927cbce10e3ce79262bcbfdbe3d85c322a6e38c4c566eb741a581e2420f" }, "downloads": -1, "filename": "pycedar-0.0.4-cp36-cp36m-macosx_10_12_x86_64.whl", "has_sig": false, "md5_digest": "d5eb2dc0585619ed9533f2f16945a5da", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": null, "size": 150376, "upload_time": "2018-08-05T21:43:42", "url": "https://files.pythonhosted.org/packages/bb/ea/4d741108a286e794b3855d0496dfd9ac73818d05fc86b07fd3943905483f/pycedar-0.0.4-cp36-cp36m-macosx_10_12_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "84aa49e8a1a763bda8bf5a7c8bf8cb1c", "sha256": "118c559e7e15fa9050e5ee4a6e8e4d27e2ec2792fc5a2cf47b6288cf47cf4845" }, "downloads": -1, "filename": "pycedar-0.0.4.tar.gz", "has_sig": false, "md5_digest": "84aa49e8a1a763bda8bf5a7c8bf8cb1c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 246807, "upload_time": "2018-08-05T21:40:50", "url": "https://files.pythonhosted.org/packages/0c/90/5db4eebdb304f74cc0b041935fe50d1f6b799787c985c80291a49b3dee77/pycedar-0.0.4.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "505753b2a4bcf0cea3afddd50a4dd03d", "sha256": "a5865543853eaaa504b235707e857048639d1f21419147576ad3e5c5eb0d91ef" }, "downloads": -1, "filename": "pycedar-0.1.1.tar.gz", "has_sig": false, "md5_digest": "505753b2a4bcf0cea3afddd50a4dd03d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15169, "upload_time": "2019-01-26T18:42:31", "url": "https://files.pythonhosted.org/packages/3b/27/aa7fc0ff7166d5ba4721627cae4355fe64093223cfcd242af83c90b277d3/pycedar-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "505753b2a4bcf0cea3afddd50a4dd03d", "sha256": "a5865543853eaaa504b235707e857048639d1f21419147576ad3e5c5eb0d91ef" }, "downloads": -1, "filename": "pycedar-0.1.1.tar.gz", "has_sig": false, "md5_digest": "505753b2a4bcf0cea3afddd50a4dd03d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15169, "upload_time": "2019-01-26T18:42:31", "url": "https://files.pythonhosted.org/packages/3b/27/aa7fc0ff7166d5ba4721627cae4355fe64093223cfcd242af83c90b277d3/pycedar-0.1.1.tar.gz" } ] }