{ "info": { "author": "Eddie Antonio Santos", "author_email": "easantos@ualberta.ca", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "***************************************\nperfection \u2014 Perfect hashing utilities\n***************************************\n\n.. image:: https://travis-ci.org/eddieantonio/perfection.svg?branch=master\n :target: https://travis-ci.org/eddieantonio/perfection\n\nA module that creates perfect hash functions for a known set of integer\ninputs.\n\n::\n\n >>> import perfection\n >>> l = (0, 3, 4, 7 ,10, 13, 15, 18, 19, 21, 22, 24, 26, 29, 30, 34)\n >>> hf = perfection.make_hash(l)\n >>> hf(19)\n 1\n\n\nInstall\n-------\n\n::\n\n pip install perfection\n\n\nMain features\n-------------\n\n- ``make_hash()`` that generates an honest-to-goodness perfect hash function\n for the given keys.\n- ``make_dict()`` creates a dictionary subclass that implements the\n MutableMapping_ interface (thus, acts exactly like a ``dict``), and\n uses the hash function created in the equivalent call to ``make_hash()``.\n\nAdditionally, ``hash_parameters()`` may be used to output the parameters of\nmaking a perfect hash for the given set of input keys. These parameters can\nthen be used to implement a perfect hash function in a language of your\nchoice.\n\nFor example, generate ``t`` and ``r`` parameters using ``hash_parameters()``::\n\n >>> l = (0, 3, 4, 7 ,10, 13, 15, 18, 19, 21, 22, 24, 26, 29, 30, 34)\n >>> params = hash_parameters(l)\n >>> params.t\n 6\n >>> params.r\n (2, 7, 12, 0, 7, 10)\n\nThen, the hash function, in pseudocode is as follows::\n\n function hash(i):\n static r = { 2, 7, 12, 0, 7, 10 }\n static t = 6\n\n x = i mod t\n y = i div t\n return x + r[y]\n\nNote that ``div`` stands for *floor* (integer) division.\n\n.. _MutableMapping: https://docs.python.org/2/library/collections.html#collections.MutableMapping\n\nBeta Features\n-------------\n\nCan import a minimal perfect (ordered!) hash function with the same API\nusing::\n\n import perfection.czech\n\nAPI is not yet finalized!\n\n\nCredit\n------\n\nAlgorithm described by `Thomas Gettys`__.\n\nPython code \u00a9 2014, 2016 Eddie Antonio Santos. MIT licensed.\n\nWith contributions by Thomas Calmant.\n\n.. __: http://www.drdobbs.com/architecture-and-design/generating-perfect-hash-functions/184404506", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/eddieantonio/perfection/tarball/v2.0.1", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/eddieantonio/perfection", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "perfection", "package_url": "https://pypi.org/project/perfection/", "platform": "any", "project_url": "https://pypi.org/project/perfection/", "project_urls": { "Download": "https://github.com/eddieantonio/perfection/tarball/v2.0.1", "Homepage": "https://github.com/eddieantonio/perfection" }, "release_url": "https://pypi.org/project/perfection/2.0.1/", "requires_dist": null, "requires_python": "", "summary": "Perfect hashing utilities for Python", "version": "2.0.1" }, "last_serial": 5138512, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "677582cc6d88e4d6abfca0705fef3758", "sha256": "1b610cef6fca80e97862b7693bc4ff902ca2eff1c1cfbf2c5cee7f03a2a8fbfe" }, "downloads": -1, "filename": "perfection-1.0.0.tar.gz", "has_sig": false, "md5_digest": "677582cc6d88e4d6abfca0705fef3758", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5793, "upload_time": "2014-08-20T00:28:01", "url": "https://files.pythonhosted.org/packages/36/01/4c7828155962189f198e93a50175126a355b1ffca54563a8caad17a9e2a7/perfection-1.0.0.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "a52f55fd4fcbf368f59d8ef6ba448638", "sha256": "8e9093d2e0a383641bf8c66515604afdaabeccc0f22e9640f397989323743f91" }, "downloads": -1, "filename": "perfection-1.0.2.tar.gz", "has_sig": false, "md5_digest": "a52f55fd4fcbf368f59d8ef6ba448638", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5987, "upload_time": "2014-08-20T01:47:24", "url": "https://files.pythonhosted.org/packages/4c/63/779ecf5db267dd07f2b98dcbdadea0b9c8045e016cd832dae0ed97a6d016/perfection-1.0.2.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "52dc1a987c343b23aa73e1ba8a568ba6", "sha256": "1a6a86a20402fe47163e47d3470d424f316793a72a4282070f6b5e54c81f2a49" }, "downloads": -1, "filename": "perfection-2.0.0.tar.gz", "has_sig": false, "md5_digest": "52dc1a987c343b23aa73e1ba8a568ba6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11093, "upload_time": "2016-11-18T19:41:08", "url": "https://files.pythonhosted.org/packages/4e/c0/fdd5adbdbb976cfd7ce996cfa3b841813772230f712c13645e353fe3efb5/perfection-2.0.0.tar.gz" } ], "2.0.0-beta": [ { "comment_text": "", "digests": { "md5": "552671317b089093de18f84cc9ae90da", "sha256": "43a1ae6fd377ebae4aa32301034fbff93f1b8ca9249ea3261e8a4fac63103e94" }, "downloads": -1, "filename": "perfection-2.0.0-beta.tar.gz", "has_sig": false, "md5_digest": "552671317b089093de18f84cc9ae90da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10464, "upload_time": "2014-09-04T20:02:02", "url": "https://files.pythonhosted.org/packages/ee/88/10fa64b6b90e09fe996a6d4d08db2913d96e3b00ad38fd6a7d3340248db5/perfection-2.0.0-beta.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "2db1322206cd7ef66e531e4684e4c6f9", "sha256": "d98e34034dbbb60027d0fb87a7d91cd0eaf5bc7e69804e9c505778195430cf7c" }, "downloads": -1, "filename": "perfection-2.0.1.tar.gz", "has_sig": false, "md5_digest": "2db1322206cd7ef66e531e4684e4c6f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11487, "upload_time": "2019-04-13T16:11:53", "url": "https://files.pythonhosted.org/packages/cb/78/e8d7888396038fc25fb1301a678123da03ea680768f6476795968aac245a/perfection-2.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2db1322206cd7ef66e531e4684e4c6f9", "sha256": "d98e34034dbbb60027d0fb87a7d91cd0eaf5bc7e69804e9c505778195430cf7c" }, "downloads": -1, "filename": "perfection-2.0.1.tar.gz", "has_sig": false, "md5_digest": "2db1322206cd7ef66e531e4684e4c6f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11487, "upload_time": "2019-04-13T16:11:53", "url": "https://files.pythonhosted.org/packages/cb/78/e8d7888396038fc25fb1301a678123da03ea680768f6476795968aac245a/perfection-2.0.1.tar.gz" } ] }