{ "info": { "author": "Odin Kroeger", "author_email": "xacuml@maskr.me", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "===============\nsortableclasses\n===============\n\nMakes classes sortable by precedence and priority. The order of precedence\nof classes and their priority is defined per class and at runtime.\n\nCopyright 2016, 2017, 2018, 2019 Odin Kroeger\n\n\n\nUse case\n========\n\n*sortableclasses* makes classes sortable by precedence and priority. This is\nuseful if you want to take some input, apply a set of transformations, and\noutput the result (i.e., if you're writing what on UNIX-ish systems is called\na 'filter'). Ordinarily, you would chain those transformations as function\ncalls (i.e., ``return transform_1(...(transform_n(input)))``), but the larger\nthe number of transformation grows, the more difficult this is to maintain.\n\n*sortableclasses* enables you to define each of those transformations as a\nclass, assign each of them a list of predecessor and successor classes or a\nnumerical priority, and then simply sort them using ``sort`` or ``sorted``.\nSimply put, it enables you to write classes that are similar to plugins\nin how they function.\n\nFor example::\n\n >>> import sortableclasses\n >>> import abc\n >>> import functools\n >>>\n >>> class Transform(sortableclasses.Pluggable):\n ... @staticmethod\n ... @abc.abstractmethod\n ... def transform(input):\n ... pass\n ...\n >>> class MakeContent(Transform):\n ... @staticmethod\n ... def transform(input):\n ... if input == ':-(':\n ... return ':-|'\n ... return input\n ...\n >>> class MakeHappy(Transform):\n ... successorof = (MakeContent,)\n ... @staticmethod\n ... def transform(input):\n ... if input == ':-|':\n ... return ':-)'\n ... return input\n ...\n >>> class MakeVeryHappy(Transform):\n ... successorof = (MakeHappy,)\n ... @staticmethod\n ... def transform(input):\n ... if input == ':-)':\n ... return ':-D'\n ... return input\n ...\n >>> transforms = sorted(Transform.getderived())\n >>> transforms\n [, , ]\n >>> input = ':-('\n >>> functools.reduce(lambda k, s: s.transform(k), transforms, input)\n ':-D'\n\n\nInstallation\n============\n\nYou use *sortableclasses* **at your own risk.**\nYou have been warned.\n\n*sortableclasses* requires Python 3.\n\nIf you have Python's `setuptools `_,\nsimply say::\n\n pip3 install sortableclasses\n\nOtherwise, download the most recent stable release (`v0.9.4\n`_),\nunzip it and copy the directory `sortableclasses` into a directory in\nyour Python's `sys.path`.\n\nYou can do all of the above by::\n\n # Download and unpack *sortableclasses* to the current directory.\n curl -f https://codeload.github.com/odkr/sortableclasses.py/tar.gz/v0.9.4 | \n tar -xz\n # The command below guesses a directory to install *sortableclasses* to.\n PYPATH=$(python3 -c 'import sys; print(\"\\n\".join(sys.path))' | \n grep -v '.zip' | grep -E \"(${HOME?}|/local/)\" | head -n1)\n # If the command below errors, no suitable directory was found.\n # Otherwise, it will show you where *sortableclasses* will be installed to.\n echo \"${PYPATH:?'Did not find a suitable directory.'}\" >&2\n # Copy the directory \"sortableclasses\" into that directory.\n [ -d \"${PYPATH:?}\" ] && {\n PACKAGE=sortableclasses.py-0.9.4/sortableclasses\n cp -r \"$PACKAGE\" \"$PYPATH\" || sudo cp -r \"$PACKAGE\" \"$PYPATH\" \n }\n # Remove the downloaded files, if you want to.\n rm -rf sortableclasses.py-0.9.4\n\n\nDocumentation\n=============\n\nYou can view the reference documentation at `Read the Docs\n`_ or,\nonce you installed *sortableclasses*, by::\n\n pydoc sortableclasses\n\n\nContact\n=======\n\nIf there's something wrong with *sortableclasses*, please `open an issue\n`_.\n\n\nLicence\n=======\n\nThis programme is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis programme is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see .\n\n\nFurther Information\n===================\n\nGitHub:\n \n\nRead the docs:\n \n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/odkr/sortableclasses/", "keywords": "plugin", "license": "GPL", "maintainer": "", "maintainer_email": "", "name": "sortableclasses", "package_url": "https://pypi.org/project/sortableclasses/", "platform": "", "project_url": "https://pypi.org/project/sortableclasses/", "project_urls": { "Homepage": "https://github.com/odkr/sortableclasses/" }, "release_url": "https://pypi.org/project/sortableclasses/0.9.4/", "requires_dist": null, "requires_python": ">=3, <4", "summary": "Retrieve all classes derived from a class and sort them by a given priority and order, making it easy to draw up and use plugin-like classes.", "version": "0.9.4" }, "last_serial": 4665957, "releases": { "0.9.4": [ { "comment_text": "", "digests": { "md5": "24b503a835c6b67d277cf641b3941cc1", "sha256": "f70535157657a95d38792ccd0c9080690e09c73f81bca1aa4ebbbf724f51c8b3" }, "downloads": -1, "filename": "sortableclasses-0.9.4-py3-none-any.whl", "has_sig": false, "md5_digest": "24b503a835c6b67d277cf641b3941cc1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3, <4", "size": 19049, "upload_time": "2019-01-06T16:04:32", "url": "https://files.pythonhosted.org/packages/78/86/155a5fa33f08a17d0e8b6c791e2441bbfefe2434764fa0f8859423a88631/sortableclasses-0.9.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4b9814bd47836a2c8e27ecaaa068d186", "sha256": "ff6b4cf387ee3739b4b833e2b6d49cf91f35fbc64eb1cf10ed889f3407956507" }, "downloads": -1, "filename": "sortableclasses-0.9.4.tar.gz", "has_sig": false, "md5_digest": "4b9814bd47836a2c8e27ecaaa068d186", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3, <4", "size": 19135, "upload_time": "2019-01-06T16:04:33", "url": "https://files.pythonhosted.org/packages/61/70/ce1ec4371b0cd2275f175c50ec8d211a8b857d9f264368be47198859adea/sortableclasses-0.9.4.tar.gz" } ], "0.9.4b0": [ { "comment_text": "", "digests": { "md5": "7f477c4045050a417794ba8a1e20c551", "sha256": "70ebb85f90ac45e32091182cd321680502eb3aedb9fe906f6ac1e287c7ec4ea8" }, "downloads": -1, "filename": "sortableclasses-0.9.4b0-py3-none-any.whl", "has_sig": false, "md5_digest": "7f477c4045050a417794ba8a1e20c551", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18445, "upload_time": "2018-12-29T21:54:25", "url": "https://files.pythonhosted.org/packages/39/2d/f286c655a51cc396ed4339d307fa47eec2df2e96996bd6613819d8d2ce93/sortableclasses-0.9.4b0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3d6baa740b94c8b3da6c4a80f50d7807", "sha256": "3c513b0df218bb9c15f9f4a6eb21024f7bfb4498258d5e78aca8d8f76a939aaa" }, "downloads": -1, "filename": "sortableclasses-0.9.4b0.tar.gz", "has_sig": false, "md5_digest": "3d6baa740b94c8b3da6c4a80f50d7807", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17906, "upload_time": "2018-12-29T21:54:29", "url": "https://files.pythonhosted.org/packages/17/d7/b894a7ef722741aee096d27faadd970a42fbff75a77b400d790bd7d30cd9/sortableclasses-0.9.4b0.tar.gz" } ], "0.9.4rc25": [ { "comment_text": "", "digests": { "md5": "c7a3935e4e0f741c7636cceb5a318c5f", "sha256": "85e408fa9c08fc08b5a0543a896c81c9cb55540df69ebe6dde1793aff98d1cda" }, "downloads": -1, "filename": "sortableclasses-0.9.4rc25-py3-none-any.whl", "has_sig": false, "md5_digest": "c7a3935e4e0f741c7636cceb5a318c5f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3, <4", "size": 19112, "upload_time": "2019-01-05T21:21:03", "url": "https://files.pythonhosted.org/packages/30/50/63951025d46ecae426494011dcbcb09616489928c10e1ea3a1ceffd2c986/sortableclasses-0.9.4rc25-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "903f389b438c276fc0abb622b43057f7", "sha256": "ebc98e6d5242468bb3504645ca895709dd573b283ee08eab28a5acd8e82149b0" }, "downloads": -1, "filename": "sortableclasses-0.9.4rc25.tar.gz", "has_sig": false, "md5_digest": "903f389b438c276fc0abb622b43057f7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3, <4", "size": 19176, "upload_time": "2019-01-05T21:21:05", "url": "https://files.pythonhosted.org/packages/02/18/e5aefeaeec97514de4ca6b5fe9d3768ac51dde47d39c4b3c9269abe3b909/sortableclasses-0.9.4rc25.tar.gz" } ], "0.9.4rc30": [ { "comment_text": "", "digests": { "md5": "894b32e67e5be0dea0715c6bd217808c", "sha256": "c353be25b1ba2967936f9407f9c7d9a59ba9ecf883b680c12844c8aebd5a94fd" }, "downloads": -1, "filename": "sortableclasses-0.9.4rc30-py3-none-any.whl", "has_sig": false, "md5_digest": "894b32e67e5be0dea0715c6bd217808c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3, <4", "size": 19102, "upload_time": "2019-01-06T14:59:52", "url": "https://files.pythonhosted.org/packages/0d/5a/ed349ea9c1b2d95ea963a5bf882118f246298f33a963c48d984d9dae8b3a/sortableclasses-0.9.4rc30-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "24d7a5e1481b4a08d6d104b4e0ce7094", "sha256": "41a8c21e0c75f7e31fd426905e169ea9ffa5bad2651184ea356a3f8bba053eb5" }, "downloads": -1, "filename": "sortableclasses-0.9.4rc30.tar.gz", "has_sig": false, "md5_digest": "24d7a5e1481b4a08d6d104b4e0ce7094", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3, <4", "size": 19157, "upload_time": "2019-01-06T14:59:54", "url": "https://files.pythonhosted.org/packages/ea/af/4831ac51326ab4ac710157d964233f4ab94a456749f6ac1c25c9553aef49/sortableclasses-0.9.4rc30.tar.gz" } ], "0.9.4rc31": [ { "comment_text": "", "digests": { "md5": "7ca0dadcb2dd37332fe2e9bf7ee63c84", "sha256": "4bcf6a7baaad23cf84441acfe478c0f23d91d8cbbb219e6fbb75ba44760636bd" }, "downloads": -1, "filename": "sortableclasses-0.9.4rc31-py3-none-any.whl", "has_sig": false, "md5_digest": "7ca0dadcb2dd37332fe2e9bf7ee63c84", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3, <4", "size": 19098, "upload_time": "2019-01-06T15:03:32", "url": "https://files.pythonhosted.org/packages/be/58/41273ff134a6017344d2f69869f35c3cf9d283069a4f9104e31933f0344a/sortableclasses-0.9.4rc31-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "044540e586c178b1fe77d4d912375eb1", "sha256": "5b7d28d511be770591fff8374f93a8fcd2f17bba4fcfc8650a4787762f67aaf5" }, "downloads": -1, "filename": "sortableclasses-0.9.4rc31.tar.gz", "has_sig": false, "md5_digest": "044540e586c178b1fe77d4d912375eb1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3, <4", "size": 19148, "upload_time": "2019-01-06T15:03:34", "url": "https://files.pythonhosted.org/packages/94/3d/b8f099c57c83f6ab7b59d15274595aced8b4da21dd2376e2bc25d58ab60d/sortableclasses-0.9.4rc31.tar.gz" } ], "0.9.4rc32": [ { "comment_text": "", "digests": { "md5": "b10827277871aebc625a9997d38ce2d3", "sha256": "d60c964d8103c45e59cc7033df9fddc0d2e7967659c559a2462c9ddacd2eb361" }, "downloads": -1, "filename": "sortableclasses-0.9.4rc32-py3-none-any.whl", "has_sig": false, "md5_digest": "b10827277871aebc625a9997d38ce2d3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3, <4", "size": 19097, "upload_time": "2019-01-06T15:34:45", "url": "https://files.pythonhosted.org/packages/fa/2a/26051eec1a35386f39f7888349508de50f83a4657c09518a2498a6f15ae7/sortableclasses-0.9.4rc32-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "39f42314feb88139c6f0c1e51eec5525", "sha256": "563289b6f66a7394903a09dd5a700fdb266b98f6fedf3883f152b197197a31ca" }, "downloads": -1, "filename": "sortableclasses-0.9.4rc32.tar.gz", "has_sig": false, "md5_digest": "39f42314feb88139c6f0c1e51eec5525", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3, <4", "size": 19154, "upload_time": "2019-01-06T15:34:47", "url": "https://files.pythonhosted.org/packages/e4/57/4a31e247702f88f7393d521a4351589b7770f0472fe5b2d9362034c1be20/sortableclasses-0.9.4rc32.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "24b503a835c6b67d277cf641b3941cc1", "sha256": "f70535157657a95d38792ccd0c9080690e09c73f81bca1aa4ebbbf724f51c8b3" }, "downloads": -1, "filename": "sortableclasses-0.9.4-py3-none-any.whl", "has_sig": false, "md5_digest": "24b503a835c6b67d277cf641b3941cc1", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3, <4", "size": 19049, "upload_time": "2019-01-06T16:04:32", "url": "https://files.pythonhosted.org/packages/78/86/155a5fa33f08a17d0e8b6c791e2441bbfefe2434764fa0f8859423a88631/sortableclasses-0.9.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4b9814bd47836a2c8e27ecaaa068d186", "sha256": "ff6b4cf387ee3739b4b833e2b6d49cf91f35fbc64eb1cf10ed889f3407956507" }, "downloads": -1, "filename": "sortableclasses-0.9.4.tar.gz", "has_sig": false, "md5_digest": "4b9814bd47836a2c8e27ecaaa068d186", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3, <4", "size": 19135, "upload_time": "2019-01-06T16:04:33", "url": "https://files.pythonhosted.org/packages/61/70/ce1ec4371b0cd2275f175c50ec8d211a8b857d9f264368be47198859adea/sortableclasses-0.9.4.tar.gz" } ] }