{ "info": { "author": "Corbin Simpson", "author_email": "cds@corbinsimpson.com", "bugtrack_url": null, "classifiers": [], "description": "=========\nBlackjack\n=========\n\nBlackjack is a simple implementation of the classic red-black tree as a\nstandard Python data structure. A set and a dictionary are included::\n\n >>> from blackjack import BJ, Deck\n >>> bj = BJ()\n >>> bj\n BJ([])\n >>> bj.add(42)\n >>> 42 in bj\n True\n >>> d = Deck()\n >>> d[1] = 2\n >>> d[3] = 4\n >>> d.keys()\n [1, 3]\n >>> d.values()\n [2, 4]\n\nUsage\n=====\n\nBlackjacks and decks behave just like normal Python sets and dictionaries, but\nhave different performance characteristics and different requirements for\nkeys. All keys must be comparable, but need not be hashable::\n\n >>> bj = BJ()\n >>> bj.add([1])\n >>> bj.add([1,2])\n >>> bj.add([1,2,3])\n >>> bj\n BJ([[1], [1, 2], [1, 2, 3]])\n\nThis does impact heterogeneity somewhat, but shouldn't be a problem for most\ncommon uses. On the other hand, the average and worst-case times for access,\nmembership testing, insertion, and deletion are all logarithmic, which makes\nblackjacks ideal for storing mappings of data with untrusted keys::\n\n $ python -mtimeit \\\n > -s 'l = [(x*(2**64 - 1), hash(x*(2**64 - 1))) for x in xrange(10000)]' \\\n > 'dict(l)'\n 10 loops, best of 3: 4.11 sec per loop\n $ python -mtimeit \\\n -s 'l = [(x*(2**64 - 1), hash(x*(2**64 - 1))) for x in xrange(10000)]\n from blackjack import Deck' \\\n 'Deck(l)'\n 10 loops, best of 3: 2.07 sec per loop\n\nEven on small- to medium-sized sets of data, blackjacks quickly become more\neffective than dictionaries in the face of untrusted input.\n\nThis package only contains the ``blackjack`` module; tests are in the module\nand may be run with any standard test runner::\n\n $ trial blackjack | tail -n1\n PASSED (successes=17)\n\nTechnical information\n=====================\n\nThe specific trees used are left-leaning red-black trees. Red children are\nopportunistically reduced during balancing if nodes will be recreated anyway;\nthis tends to shorten overall tree height by reducing the number of red\nchildren. Complexities are as follows:\n\n========== ========== ========\nOperation Time Space\n========== ========== ========\nLookup O(log n) O(1)\nMembership O(log n) O(1)\nInsertion O(log n) O(log n)\nDeletion O(log n) O(log n)\nUpdate O(log n) O(log n)\nSort O(1) O(1)\nLength O(1) O(1)\n========== ========== ========\n\nSorting according to the provided key function is constant because the tree's\ntraversal order is presorted. Length is recorded and updated on mutation.\nNodes are persistent and altering the tree generally requires a logarithmic\nspace commitment to create new nodes.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/MostAwesomeDude/blackjack", "keywords": null, "license": "MIT/X11", "maintainer": null, "maintainer_email": null, "name": "blackjack", "package_url": "https://pypi.org/project/blackjack/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/blackjack/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/MostAwesomeDude/blackjack" }, "release_url": "https://pypi.org/project/blackjack/1.1.1/", "requires_dist": null, "requires_python": null, "summary": "Red-black trees", "version": "1.1.1" }, "last_serial": 871124, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "ffe6e5fec1254b66e1160a58831e99d7", "sha256": "8cca2b64d9a2f3b476125b3237224fdec1617b2152f4677f91b2dcf6f7b4da28" }, "downloads": -1, "filename": "blackjack-1.0.tar.gz", "has_sig": false, "md5_digest": "ffe6e5fec1254b66e1160a58831e99d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4483, "upload_time": "2013-09-21T19:33:19", "url": "https://files.pythonhosted.org/packages/95/e0/53f10140a2ed363d0b934c8275bcb36421e752d97e9088a17e6a03b1890c/blackjack-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "a3be9ebc6145adb1445914274aa52ad8", "sha256": "5329672f29132fd13d5ac248c9da305338d4a40a598761da0e7258168064bec4" }, "downloads": -1, "filename": "blackjack-1.1.tar.gz", "has_sig": false, "md5_digest": "a3be9ebc6145adb1445914274aa52ad8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6108, "upload_time": "2013-09-22T16:15:09", "url": "https://files.pythonhosted.org/packages/38/b8/34c2945417ad6a148cefc611b0431b47dbc791bbed237508f6d9c23216ec/blackjack-1.1.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "f6ab60d22e93f1d60a8f75688380c91a", "sha256": "9b709b61fc2888f3ab76231c78c1e1642e89f4c67a3e2629481680a8100801e0" }, "downloads": -1, "filename": "blackjack-1.1.1.tar.gz", "has_sig": false, "md5_digest": "f6ab60d22e93f1d60a8f75688380c91a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6200, "upload_time": "2013-09-22T16:18:10", "url": "https://files.pythonhosted.org/packages/bf/36/fcfea476d0def0fb62d4d65646d4ac6898381018aa99fc847f5cd44a5bc9/blackjack-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f6ab60d22e93f1d60a8f75688380c91a", "sha256": "9b709b61fc2888f3ab76231c78c1e1642e89f4c67a3e2629481680a8100801e0" }, "downloads": -1, "filename": "blackjack-1.1.1.tar.gz", "has_sig": false, "md5_digest": "f6ab60d22e93f1d60a8f75688380c91a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6200, "upload_time": "2013-09-22T16:18:10", "url": "https://files.pythonhosted.org/packages/bf/36/fcfea476d0def0fb62d4d65646d4ac6898381018aa99fc847f5cd44a5bc9/blackjack-1.1.1.tar.gz" } ] }