{ "info": { "author": "David Wolever", "author_email": "david@wolever.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development" ], "description": "``safesort``: safely sort heterogeneous collections on Python 2 and 3\n=====================================================================\n\n.. image:: https://travis-ci.org/wolever/safesort.svg?branch=master\n :target: https://travis-ci.org/wolever/safesort\n\n\n``safesort`` does what it says on the box: guarantees safe sorting of arbitrary\nheterogeneous lists across Python 2 and Python 3::\n\n >>> list(sorted([\"a\", 1, None]))\n Traceback (most recent call last):\n File \"\", line 1, in \n TypeError: unorderable types: int() < str()\n >>> list(safesort([\"a\", 1, None))\n [None, 1, 'a']\n\nThree ordering keys are attempted for each comparison:\n\n 1. Object: ``objA > objB``\n\n 2. Type-and-object: ``(type(objA).__mro__, objA) > (type(objB).__mro__, objB)``\n\n 3. Type-and-identity: ``(type(objA).__mro__, id(objA)) > (type(objB).__mro__, id(objB))``\n\nThis guarantees a total ordering which is:\n\n 1. As consistent as possible\n 2. Broadly sensible: objects with similar types will be grouped together\n\nFor example::\n\n >>> from safesort import safesort\n >>> input = ['a', set([]), [], {}, 1, None]\n >>> list(safesort(input))\n [None, 1, {}, [], set([]), 'a']\n\n\nInstallation\n------------\n\n``safesort`` can be installed with Python 2 or Python 3 using ``pip`` or\n``easy_install``::\n\n $ pip install safesort\n - OR -\n $ easy_install safesort", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/wolever/safesort", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "safesort", "package_url": "https://pypi.org/project/safesort/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/safesort/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/wolever/safesort" }, "release_url": "https://pypi.org/project/safesort/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "Safely sort heterogeneous collections.", "version": "0.2.0" }, "last_serial": 1599661, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "04ba0242af6a0ee4e0a176219af9bee6", "sha256": "e76cb7a4ab51c71229aa00798c67f27d8495f696506604a8ad2e2a6870162122" }, "downloads": -1, "filename": "safesort-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "04ba0242af6a0ee4e0a176219af9bee6", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4122, "upload_time": "2015-06-19T21:19:57", "url": "https://files.pythonhosted.org/packages/3d/88/2a1ae0ab8cfdcdd22e2a33b1562eade6da8c5758153f8260be08314d216e/safesort-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8a56385656729ce58e1d48990f2a5d34", "sha256": "a6b37e6708d39072dd27316d3146d1c32fb1babdb1fd01d90961c7dc2e00dcce" }, "downloads": -1, "filename": "safesort-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8a56385656729ce58e1d48990f2a5d34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2515, "upload_time": "2015-06-19T21:19:54", "url": "https://files.pythonhosted.org/packages/12/12/acc06ea4f237a8009d09b22f42bf69f9543e116e1ae87e92dd52b7c75e35/safesort-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "04ba0242af6a0ee4e0a176219af9bee6", "sha256": "e76cb7a4ab51c71229aa00798c67f27d8495f696506604a8ad2e2a6870162122" }, "downloads": -1, "filename": "safesort-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "04ba0242af6a0ee4e0a176219af9bee6", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 4122, "upload_time": "2015-06-19T21:19:57", "url": "https://files.pythonhosted.org/packages/3d/88/2a1ae0ab8cfdcdd22e2a33b1562eade6da8c5758153f8260be08314d216e/safesort-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8a56385656729ce58e1d48990f2a5d34", "sha256": "a6b37e6708d39072dd27316d3146d1c32fb1babdb1fd01d90961c7dc2e00dcce" }, "downloads": -1, "filename": "safesort-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8a56385656729ce58e1d48990f2a5d34", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2515, "upload_time": "2015-06-19T21:19:54", "url": "https://files.pythonhosted.org/packages/12/12/acc06ea4f237a8009d09b22f42bf69f9543e116e1ae87e92dd52b7c75e35/safesort-0.2.0.tar.gz" } ] }