{ "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 de-centrally and at runtime.\n\nCopyright 2016, 2017, 2018 Odin Kroeger\n\n\n\nUse case\n========\n\n*sortableclasses* makes classes sortable. This is useful if all you want to do\nis take some input, apply a set of transformations, and output the result\n(i.e., are writing what on UNIX-ish systems is called a 'filter'). \nOf course, you may just write, e.g., ``return t1(t2(t3(...(tn(input))))))``\nbut the more transformations you need to add, the harder this is to maintain.\n*sortableclasses* allows you to turn the transformations into classes, assign\neach of them a priority (or a list of predecessors and successors) and then\nsort them using ``sort`` ``sorted``.\n\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* works only in Python 3.\n\nClone the repository and run `setup.py install`.\n\n\nDocumentation\n=============\n\nSee for reference.\n\nYou can also view the inline documentation, by::\n\n pydoc sortableclasses\n\n\nContact\n=======\n\nIf there's something wrong with *sortableclasses*, please open an issue at:\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", "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": "sortableclass", "package_url": "https://pypi.org/project/sortableclass/", "platform": "", "project_url": "https://pypi.org/project/sortableclass/", "project_urls": { "Homepage": "https://github.com/odkr/sortableclasses/" }, "release_url": "https://pypi.org/project/sortableclass/0.9.4b0/", "requires_dist": null, "requires_python": "", "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.4b0" }, "last_serial": 4644781, "releases": { "0.9.4b0": [ { "comment_text": "", "digests": { "md5": "0e39e8b3195e0a8b791d7ecb44776123", "sha256": "4f619f274dfd67fd20ecc1656457839e4731ee3f6a60e09696e6202a1338c455" }, "downloads": -1, "filename": "sortableclass-0.9.4b0-py3-none-any.whl", "has_sig": false, "md5_digest": "0e39e8b3195e0a8b791d7ecb44776123", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18429, "upload_time": "2018-12-29T21:54:23", "url": "https://files.pythonhosted.org/packages/c4/97/b3a2f380df38f816724944622177de59281595938858c0be462dce3e6e6f/sortableclass-0.9.4b0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c724057c608567b3b457a9924ca3f02c", "sha256": "0f2a56f82672ee63a34ba777effe8fb603efad94b9fb2d19e28e92dac82f3412" }, "downloads": -1, "filename": "sortableclass-0.9.4b0.tar.gz", "has_sig": false, "md5_digest": "c724057c608567b3b457a9924ca3f02c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17934, "upload_time": "2018-12-29T21:54:28", "url": "https://files.pythonhosted.org/packages/97/0a/9ceae10edd2ee60f47e76c0078d329ce0e889836e592cc41092f5061dd01/sortableclass-0.9.4b0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0e39e8b3195e0a8b791d7ecb44776123", "sha256": "4f619f274dfd67fd20ecc1656457839e4731ee3f6a60e09696e6202a1338c455" }, "downloads": -1, "filename": "sortableclass-0.9.4b0-py3-none-any.whl", "has_sig": false, "md5_digest": "0e39e8b3195e0a8b791d7ecb44776123", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 18429, "upload_time": "2018-12-29T21:54:23", "url": "https://files.pythonhosted.org/packages/c4/97/b3a2f380df38f816724944622177de59281595938858c0be462dce3e6e6f/sortableclass-0.9.4b0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c724057c608567b3b457a9924ca3f02c", "sha256": "0f2a56f82672ee63a34ba777effe8fb603efad94b9fb2d19e28e92dac82f3412" }, "downloads": -1, "filename": "sortableclass-0.9.4b0.tar.gz", "has_sig": false, "md5_digest": "c724057c608567b3b457a9924ca3f02c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17934, "upload_time": "2018-12-29T21:54:28", "url": "https://files.pythonhosted.org/packages/97/0a/9ceae10edd2ee60f47e76c0078d329ce0e889836e592cc41092f5061dd01/sortableclass-0.9.4b0.tar.gz" } ] }