{ "info": { "author": "Mike Malinowski", "author_email": "mike@twisted.space", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "# XComposite Overview\n\n\nThis module exposes the composite design pattern in an easy to use way\nwhich attempts to minimalise the repetitive overhead.\n\nThe composite design pattern is an alternative to top-down inheritance\nwhen there is no clear hierarchical chain. Examples might include assigning\nroles to entities - where an entity can have any variation of roles.\n\nMethods between composite parts can return all manor of variable types, \ntherefore xcomposite gives you a library of decorators which you can utilise\nto define how the collective set of results should be wrangled and returned.\n\n\n## Installation\n\n\nYou can install this using pip:\n```commandline\npip install xcomposite\n```\n\n\nAlternatively you can get the source from:\nhttps://github.com/mikemalinowski/xcomposite\n\n\n# Examples\n\nYou can utilise this pattern like this:\n\n .. code-block:: python\n\n >>> import xcomposite\n >>>\n >>>\n >>> # -- The composition class defines the decoration rules for\n >>> # -- each method which requires compositing. This must inherit\n >>> # -- from the xcomposite.Composition class.\n >>> class A(xcomposite.Composition):\n ...\n ... @xcomposite.extend_results\n ... def items(self):\n ... return ['a', 'b']\n >>>\n >>>\n >>> # -- The class(es) being bound to the composition do not need\n >>> # -- to inherit from the composition. Equally their functions\n >>> # -- do not need to be decorated either\n >>> class B(object):\n ...\n ... def items(self):\n ... return ['x', 'y']\n >>>\n >>>\n >>> # -- We instance the composition, then bind any amount of classes\n >>> # -- to that composition. All classes being bound to a composition\n >>> # -- *must* be class instances.\n >>> a = A()\n >>> a.bind(B())\n >>>\n >>> # -- Call the items method, noting that the result is the expected\n >>> # -- list of items from the 'items' call of both A and B\n >>> # -- The composition cycles through all the bound classes, and \n >>> # -- where it finds a class with the same method name it will be\n >>> # -- called.\n >>> print(a.items())\n\nAnother, similiar example might be:\n\n```python\n\n >>> import xcomposite\n >>>\n >>>\n >>> # -- Inheriting off the composition class means that your class can\n >>> # -- immediately bind any other class which is of a Composition type.\n >>> # -- You should declare (through composite decorators) what the\n >>> # -- expactation is of any bound methods. This allows you to tailor\n >>> # -- exactly how the results should be combined/returned.\n >>> class Definition(xcomposite.Composition):\n ...\n ... @xcomposite.extend_results\n ... def items(self):\n ... return ['a', 'b']\n >>>\n >>>\n >>> class MyObject(object):\n ...\n ... def items(self):\n ... return ['x', 'y']\n >>>\n >>> \n >>> class MyOtherObject(object):\n ...\n ... def items(self):\n ... return [1, 2]\n >>>\n >>>\n >>> # -- Instance any one of the classes, and bind it to the instance\n >>> # -- of the other\n >>> definition = Definition()\n >>> definition.bind(MyObject())\n >>> definition.bind(MyOtherObject())\n >>>\n >>> # -- Call the items method, noting that the result is the expected\n >>> # -- list of items from the 'items' call of both A and B\n >>> print(definition.items())\n ['a', 'b', 'x', 'y', 1, 2]\n```\n\n\n# Decorators\n\n\nAll composition rules are defined as decorators which you can apply to your\nmethods on your classes. The following decorators:\n\n\n take_min\n take_max\n take_sum\n take_range\n take_average\n take_first\n take_last\n any_true\n any_false\n absolute_true\n absolute_false\n append_unique\n append_results\n extend_results\n extend_unique\n update_dictionary\n \n\n# Restrictions\n\n\n * Version 2.0.0 onward is significantly different to version 1.x, and is therefore\nnot compatible without changes. \n\n * All methods decorated with xcomposite decorators are expected to be instance\nmethods and not class methods.\n\n* Functions which are decorated with xcomposite decorators may be decorated\nwith other decorators, but any additional decorators should sit atop of the\nxcomposite decorator.\n\n\n## Testing and Stability\n\n\nThere are currently unittests which cover most of composite's core, but it is not yet exhaustive.\n\n\n## Compatability\n\n\nThis has been tested under Python 2.7.13 and Python 3.6.6 on both Ubuntu and Windows.\n\n\n## Contribute\n\n\nIf you would like to contribute thoughts, ideas, fixes or features please get in touch! mike@twisted.space", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mikemalinowski/xcomposite", "keywords": "xcomposite composite composition inheritence side combine", "license": "", "maintainer": "", "maintainer_email": "", "name": "xcomposite", "package_url": "https://pypi.org/project/xcomposite/", "platform": "", "project_url": "https://pypi.org/project/xcomposite/", "project_urls": { "Homepage": "https://github.com/mikemalinowski/xcomposite" }, "release_url": "https://pypi.org/project/xcomposite/2.0.5/", "requires_dist": null, "requires_python": "", "summary": "A python package exposing the class composition design pattern", "version": "2.0.5" }, "last_serial": 4984843, "releases": { "0.9.4": [ { "comment_text": "", "digests": { "md5": "bf5968b55665ba310ed83f87264aa874", "sha256": "954dd5744db2c51e724bc2534f748182e1778cf4750147fab416cccca559406a" }, "downloads": -1, "filename": "xcomposite-0.9.4-py3-none-any.whl", "has_sig": false, "md5_digest": "bf5968b55665ba310ed83f87264aa874", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21184, "upload_time": "2018-11-22T18:09:27", "url": "https://files.pythonhosted.org/packages/51/79/b5bb1a2f8b52012e2ed2c4bbace4655e3fa523bc1a07a5251af2fb77595c/xcomposite-0.9.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1106c2ed246d43c1e5748a102ae013de", "sha256": "86fbcac0916dc293e8e2b9da599ca8b839a3177fd231bc74c170441ecb4a153e" }, "downloads": -1, "filename": "xcomposite-0.9.4.tar.gz", "has_sig": false, "md5_digest": "1106c2ed246d43c1e5748a102ae013de", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15941, "upload_time": "2018-11-22T18:09:29", "url": "https://files.pythonhosted.org/packages/c5/b5/981d36b3da989cb25afb3e3633c87e48f552543a51f85391f0a3970a3feb/xcomposite-0.9.4.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "126ac15ac74b6c175f7517b5a29ffa23", "sha256": "8768590b643f2a222b2fcac38cf954dd1a618ba399ad5e345a966920695f3263" }, "downloads": -1, "filename": "xcomposite-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "126ac15ac74b6c175f7517b5a29ffa23", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 21953, "upload_time": "2018-11-25T20:08:46", "url": "https://files.pythonhosted.org/packages/72/5d/b6252386e351fe6c5a71181663f1404d4a159cbe1cb6f8631fe273ce9e86/xcomposite-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "50f9df46fc85c138f2c25cd47f6c317c", "sha256": "9d7d8b9f17096199fa0b2a76c8237258dd7a8ca7e298b564711be3610c223840" }, "downloads": -1, "filename": "xcomposite-1.0.0.tar.gz", "has_sig": false, "md5_digest": "50f9df46fc85c138f2c25cd47f6c317c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16786, "upload_time": "2018-11-25T20:08:48", "url": "https://files.pythonhosted.org/packages/65/ca/dd399a44a043271c73f43bd6d5016ef7ee9e4b8e076271b8cacfdc02301e/xcomposite-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "988e8d07c78a6093202932ba0284cbe6", "sha256": "8950765c4677a987d8d3d27b2523fc8bbd2406799d7fec52075511af65798ffc" }, "downloads": -1, "filename": "xcomposite-1.0.1.zip", "has_sig": false, "md5_digest": "988e8d07c78a6093202932ba0284cbe6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23921, "upload_time": "2019-02-26T16:34:23", "url": "https://files.pythonhosted.org/packages/9e/e1/9a9d3b6caf30a897ec50394078da3d65affb0cef870b6ed3f241bfd15f9e/xcomposite-1.0.1.zip" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "d5e08777f158bfb17185fb2dc5ddd2a6", "sha256": "4a13f460123c1047fce264da7993ac61b5fcbcfa397d7df3f1f7a4fc6ecd05e5" }, "downloads": -1, "filename": "xcomposite-1.0.2.tar.gz", "has_sig": false, "md5_digest": "d5e08777f158bfb17185fb2dc5ddd2a6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16820, "upload_time": "2019-03-03T17:11:11", "url": "https://files.pythonhosted.org/packages/0c/c2/8759e8bb44165b0e8bf9d0ea0927c182f3755e638b89483a75ad5da47c8a/xcomposite-1.0.2.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "789f7038e73f67cf4707a6448ed11ba0", "sha256": "4c4173a309b4f254d13a4b7bfcd946fb13f0b7a00582b03a9a206d73e4facf17" }, "downloads": -1, "filename": "xcomposite-2.0.1.zip", "has_sig": false, "md5_digest": "789f7038e73f67cf4707a6448ed11ba0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12961, "upload_time": "2019-03-19T17:28:42", "url": "https://files.pythonhosted.org/packages/13/d8/4f768c8090ec138bf9d6dc4364cb91b8654ddac6273b2b0000455c0c1adf/xcomposite-2.0.1.zip" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "3639794396983ed8ed05a8702b41b920", "sha256": "1d92a8ca7232b5f923eab8718b4afa371affb49b21470b7b83c660662109614a" }, "downloads": -1, "filename": "xcomposite-2.0.2.zip", "has_sig": false, "md5_digest": "3639794396983ed8ed05a8702b41b920", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12996, "upload_time": "2019-03-19T17:30:54", "url": "https://files.pythonhosted.org/packages/30/bb/5218d1490d40bdc237fdb2cc8e2592eade5d9734ac89981fe8dcd26f5cec/xcomposite-2.0.2.zip" } ], "2.0.3": [ { "comment_text": "", "digests": { "md5": "d88ab6adefa06aee9781ec2018e00c01", "sha256": "ac3bfc543ba26fe1bb07e75e3502b90d9531a1caf1445b949ea89d048a13b38a" }, "downloads": -1, "filename": "xcomposite-2.0.3.zip", "has_sig": false, "md5_digest": "d88ab6adefa06aee9781ec2018e00c01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13010, "upload_time": "2019-03-19T17:32:39", "url": "https://files.pythonhosted.org/packages/60/32/b29893031bc5fdd65413647d8c6ff4e6a56c4c285719b7abee5d43e1bd03/xcomposite-2.0.3.zip" } ], "2.0.4": [ { "comment_text": "", "digests": { "md5": "3062f1125268a62571472b6c2ad29272", "sha256": "a3b901b131d540e0e4c72f4680a347143a318c401bc0e116104753b8be9d04cb" }, "downloads": -1, "filename": "xcomposite-2.0.4.tar.gz", "has_sig": false, "md5_digest": "3062f1125268a62571472b6c2ad29272", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9538, "upload_time": "2019-03-19T17:35:27", "url": "https://files.pythonhosted.org/packages/b3/35/d96720d23c4b3b7534ce63286640d7c2ec9b9f0eb85e90aa5dc4de606de0/xcomposite-2.0.4.tar.gz" } ], "2.0.5": [ { "comment_text": "", "digests": { "md5": "c920fafd5a8af8cdc43b5118a0cdb222", "sha256": "79ce3dabcd7c928c09338d47e5275ceb5e18b574f22d473f1045cc73c5ba8d46" }, "downloads": -1, "filename": "xcomposite-2.0.5.tar.gz", "has_sig": false, "md5_digest": "c920fafd5a8af8cdc43b5118a0cdb222", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9425, "upload_time": "2019-03-25T22:07:40", "url": "https://files.pythonhosted.org/packages/f1/f6/849dea587ffef17eeaa0066d96eb26f6bf10a69855b0abfd9cb7d371e47d/xcomposite-2.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c920fafd5a8af8cdc43b5118a0cdb222", "sha256": "79ce3dabcd7c928c09338d47e5275ceb5e18b574f22d473f1045cc73c5ba8d46" }, "downloads": -1, "filename": "xcomposite-2.0.5.tar.gz", "has_sig": false, "md5_digest": "c920fafd5a8af8cdc43b5118a0cdb222", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9425, "upload_time": "2019-03-25T22:07:40", "url": "https://files.pythonhosted.org/packages/f1/f6/849dea587ffef17eeaa0066d96eb26f6bf10a69855b0abfd9cb7d371e47d/xcomposite-2.0.5.tar.gz" } ] }