{ "info": { "author": "julien tayon", "author_email": "julien@tayon.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: Python Software Foundation License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": ".. image:: https://travis-ci.org/jul/archery.svg?branch=master\n :target: https://travis-ci.org/jul/archery\n\n.. image:: https://badge.fury.io/py/archery.svg\n :target: https://badge.fury.io/py/archery\n\n.. image:: https://codecov.io/gh/jul/archery/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/jul/archery\n\n.. image:: https://readthedocs.org/projects/archery/badge/?version=latest\n :target: https://archery.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n\n.. image:: https://img.shields.io/badge/py2.7|3.3|3.4|3.5|3.6|3.7-ok-brightgreen.svg\n\n\n\n* Source : https://github.com/jul/archery\n* Tickets : https://github.com/jul/archery/issues?state=open\n* Latest documentation : http://archery.readthedocs.org/en/latest/index.html\n\nWhat is archery?\n================\n\nIt is set of Mixins to use on MutableMapping giving the following features :\n\n- Linear Algebrae;\n- Vector like metrics;\n- Searchable behaviour;\n\nfor convenience 3 concrete classes are provided :\n\n- `mdict`_ (dict that follow the rules of linear algebrae based on dict);\n- `vdict`_ (dict that have cos, abs, dot product);\n- `sdict`_ (dict that are easily searchable);\n\n\nBasic Usage\n===========\n\nUsing the ready to use class derived from dict\n\nmdict\n*****\n\n**dict that supports consistently all the linear algebrae properties**\n\nBasically : dict that are vectors on arbitrary basis (recursively).\n\nTo learn more about its use and implementation:\n\n- `Video presentation in FOSDEM 2017 `_\n- `or look at the presentation `_\n\nex::\n\n >>> from archery import mdict\n >>> point = mdict(x=1, y=1, z=1)\n >>> point2 = mdict(x=1, y=-1)\n >>> print( (2 * point + point2)/4)\n >>> # OUT : {'y': 0.25, 'x': 0.75, 'z': 0.5}\n >>> print(point - point2)\n >>> # OUT : {'y': 2, 'x': 0, 'z': 1}\n >>> b=mdict(x=2, z=-1)\n >>> a=mdict(x=1, y=2.0)\n >>> a+b\n >>> # OUT: {'y': 2.0, 'x': 3, 'z': -1}\n >>> b-a\n >>> # OUT: {'y': -2.0, 'x': 1, 'z': -1}\n >>> -(a-b)\n >>> # OUT: {'y': -2.0, 'x': 1, 'z': -1}\n >>> a+1\n >>> # OUT: {'y': 3.0, 'x': 2}\n >>> -1-a\n >>> # OUT: {'y': -3.0, 'x': -2}\n >>> a*b\n >>> # OUT: {'x': 2}\n >>> a/b\n >>> # OUT: {'x': 0}\n >>> 1.0*a/b\n >>> # OUT: {'x': 0.5}\n\nvdict\n*****\n\n\ndict that defines *abs()*, *dot()*, *cos()* in the euclidean meaning\n\nex::\n\n >>> from archery import vdict as Point\n >>>\n >>> u = Point(x=1, y=1)\n >>> v = Point(x=1, y=0)\n >>> u.cos(v)\n >>> 0.7071067811865475\n >>> u.dot(v)\n >>> # OUT: 1\n >>> u.cos(2*v)\n >>> # OUT: 0.7071067811865475\n >>> u.dot(2*v)\n >>> #OUT: 2\n >>> abs(u)\n >>> #OUT: 1.4142135623730951\n >>> u3 = Point(x=1, y=1, z=2)\n >>> u4 = Point(x=1, y=3, z=4)\n >>> u3 + u4\n >>> #OUT: dict(x=2, y=4, z=6)\n >>> assert u4 + u4 == 2*u4\n >>> from archery import vdict\n >>> from math import acos, pi\n >>> point = vdict(x=1, y=1, z=1)\n >>> point2 = vdict(x=1, y=-1)\n >>> point2 = mdict(x=1, y=-1)\n >>> print( (2 * point + point2)/4)\n >>> # OUT : {'y': 0.25, 'x': 0.75, 'z': 0.5}\n >>> print(acos(vdict(x=1,y=0).cos(vdict(x=1, y=1)))*360/2/pi)\n >>> # OUT : 45.0\n >>> print(abs(vdict(x=1, y=1)))\n >>> # OUT : 1.41421356237\n >>> print(vdict(x=1,y=0,z=3).dot(vdict(x=1, y=1, z=-1)))\n >>> #OUT -2\n\n\nsdict\n*****\n\ndict made for searching value/keys/*Path* with special interests.\n\nBasically, it returns an iterator in the form of a tuple being all the keys and the value.\nIt is a neat trick, if you combine it with *make_from_path*, it helps select exactly what you want in a dict::\n\n\n >>> from archery import sdict, make_from_path\n >>> tree = sdict(\n ... a = 1,\n ... b = dict(\n ... c = 3.0,\n ... d = dict(e=True)\n ... ),\n ... point = dict( x=1, y=1, z=0),\n ... )\n >>> list(tree.leaf_search(lambda x: type(x) is float ))\n >>> #Out: [3.0]\n >>> res = list(tree.search(lambda x: (\"point\") in x ))\n >>> ## equivalent to list(tree.search(lambda x: Path(x).contains(\"point\")))\n >>> print(res)\n >>> #Out: [('point', 'y', 1), ('point', 'x', 1), ('point', 'z', 0)]\n >>> make_from_path(dict(), res)\n >>> # {('point', 'y', 1): {('point', 'x', 1): ('point', 'z', 0)}}\n\n\nAdvanced usage\n==============\n\nThis library is a proof of the consistent use of Mixins on `MutableMapping `_ gives the property seen in the basic usage.\n\n\nThe Mixins do not require any specifics regarding the implementation and **should** work if I did my job properly with\nany kinds of *MutableMapping*.\n\nHere is an example of a cosine similarities out of the box on the *Collections.Counter* ::\n\n >>> from collections import Counter\n >>> from archery import VectorDict\n >>> class CWCos(VectorDict, Counter):\n ... pass\n >>>\n >>> CWCos([\"mot\", \"wut\", \"wut\", \"bla\"]).cos(CWCos([\"mot\",\"wut\", \"bla\"]))\n >>> # OUT: 0.942809041582\n\nYou can also inherit LinearAlgebrae\n\n\nResource\n********\n\nTicketing: https://github.com/jul/archery/issues?state=open\nSource: https://github.com/jul/archery\nLatest documentation: http://archery.readthedocs.org/en/latest/index.html", "description_content_type": "", "docs_url": "https://pythonhosted.org/archery/", "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://archery.readthedocs.org/", "keywords": "", "license": "Python Software Foundation License", "maintainer": "", "maintainer_email": "", "name": "archery", "package_url": "https://pypi.org/project/archery/", "platform": "", "project_url": "https://pypi.org/project/archery/", "project_urls": { "Homepage": "http://archery.readthedocs.org/" }, "release_url": "https://pypi.org/project/archery/1.2.2/", "requires_dist": null, "requires_python": "", "summary": "Traits (Mixins) to give +,/,-,* to MutableMapping", "version": "1.2.2" }, "last_serial": 4440565, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "5769033b183405c3134bf0273b25f6ca", "sha256": "7f2278f64b097a26f2f16d5ef56937a80bbd518572b6acebacba73e2c5ce518a" }, "downloads": -1, "filename": "archery-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5769033b183405c3134bf0273b25f6ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6366, "upload_time": "2012-05-31T16:33:50", "url": "https://files.pythonhosted.org/packages/13/79/f5b6e965bfa9e99e2ac3a66fa87cdec1d2890572ba5fd6e30bf25efb4f93/archery-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "915860f1bae5970248ee9ddcfcc62f5a", "sha256": "024433d7023a9a8f8c213b20f6cc4bb8accdb5031dadb6717d99529ccfe6d8dd" }, "downloads": -1, "filename": "archery-0.1.1.tar.gz", "has_sig": false, "md5_digest": "915860f1bae5970248ee9ddcfcc62f5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6466, "upload_time": "2012-06-18T14:42:27", "url": "https://files.pythonhosted.org/packages/9f/4e/f26fda54ea89d4cd49d0e67258ad84a41acff982340d939847061485ad9e/archery-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "cc6215ee8740f5dae176e957eda71880", "sha256": "8a379c8d230485e24ab65517419559b2e4df47fe7bb7dfab02c50d7c6f8d7012" }, "downloads": -1, "filename": "archery-0.1.2.tar.gz", "has_sig": false, "md5_digest": "cc6215ee8740f5dae176e957eda71880", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10251, "upload_time": "2012-07-18T17:11:49", "url": "https://files.pythonhosted.org/packages/e8/02/dbed1be16f84585c3a8f561685d5c7f575312ea87b33fe7202a5aaed45ed/archery-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "3eea44481abac7985f1555412312ec70", "sha256": "abffebfcf518b646cc9f49c476bddd41a475819898f980bfabae94fc2d6f98da" }, "downloads": -1, "filename": "archery-0.1.3.tar.gz", "has_sig": false, "md5_digest": "3eea44481abac7985f1555412312ec70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10278, "upload_time": "2012-07-18T17:30:17", "url": "https://files.pythonhosted.org/packages/8e/90/a3cb7f8fdd83496857d5181d9f14948978fdf79ea9cb527637a5974d0ea6/archery-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "714e8a5f8644726ffd4487789ea711bc", "sha256": "a8138cda787d4947bfe03dfd0ed4f4cae3a94f3352c82d300f09876315d1f50e" }, "downloads": -1, "filename": "archery-0.1.4.tar.gz", "has_sig": false, "md5_digest": "714e8a5f8644726ffd4487789ea711bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10401, "upload_time": "2012-09-03T15:46:53", "url": "https://files.pythonhosted.org/packages/35/2a/99770f4c50b2195ee10377152c9e6b71c4d9a79ce70a41ba0d1c018a81c9/archery-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "55921ab5259c1629dfbf6339f3eb962a", "sha256": "1588f00ef5c64a3cf80d949ebd35193beca0f98e902da4512b78cf270cf3469c" }, "downloads": -1, "filename": "archery-0.1.5.tar.gz", "has_sig": false, "md5_digest": "55921ab5259c1629dfbf6339f3eb962a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10430, "upload_time": "2012-09-03T16:15:36", "url": "https://files.pythonhosted.org/packages/8e/8d/9242d7701e6541ffa5b49e191ee9c2577c6f75ca873e998426c6a8ee6425/archery-0.1.5.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "0760e682b207423496b56801200031eb", "sha256": "0b0d759f3101fdfb7d35933045efc290668f88099ea9f71d07891f7f6ae062cc" }, "downloads": -1, "filename": "archery-0.1.7.tar.gz", "has_sig": false, "md5_digest": "0760e682b207423496b56801200031eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13128, "upload_time": "2018-10-28T16:23:38", "url": "https://files.pythonhosted.org/packages/d9/50/85085e73a32980497302d46bdc32f0a07964c2ea3e0b4bb8db32ccb6187d/archery-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "d5a45fee54183ace7880acc4a38448bd", "sha256": "28aa60679ae4f09bd48aa47606fc89fa0c48ede64cff730ce2f208dd74962b8e" }, "downloads": -1, "filename": "archery-0.1.8.tar.gz", "has_sig": false, "md5_digest": "d5a45fee54183ace7880acc4a38448bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13907, "upload_time": "2018-10-29T15:07:02", "url": "https://files.pythonhosted.org/packages/27/50/67c996ddc5f14b0fbad0d105c1cac18894c0ccbc8b5bb82357252921a028/archery-0.1.8.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "6d68c70d61cdeb3d8251e39935b6d1e4", "sha256": "0e1d2ef0e89e2dbeaa61cb739bfc43821c76f5f2dad638f3bb170836c15f37e9" }, "downloads": -1, "filename": "archery-1.0.0.tar.gz", "has_sig": false, "md5_digest": "6d68c70d61cdeb3d8251e39935b6d1e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16103, "upload_time": "2018-10-30T13:25:19", "url": "https://files.pythonhosted.org/packages/04/7c/0f6d86811455afd8da22affe9a609f5ba3634170bf4b9609597a31b59e4b/archery-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "eac9bf53c78faa8a80baa9c488766f80", "sha256": "553cfae379b0c88d71c892ff661ead1a8f44c63f995659863e69a957778748da" }, "downloads": -1, "filename": "archery-1.1.0.tar.gz", "has_sig": true, "md5_digest": "eac9bf53c78faa8a80baa9c488766f80", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16075, "upload_time": "2018-10-30T14:28:23", "url": "https://files.pythonhosted.org/packages/59/3a/34be5735a67fdde3a24a1a26fa4199689aebf0d7fe719474967d7465e019/archery-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "cf9673697b424b710dcd139e1bfa9888", "sha256": "025075374de3d58f84d838d307463710a462d6c446a087e77a0cdfa2b73e72b4" }, "downloads": -1, "filename": "archery-1.1.1.tar.gz", "has_sig": true, "md5_digest": "cf9673697b424b710dcd139e1bfa9888", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16081, "upload_time": "2018-10-30T14:34:39", "url": "https://files.pythonhosted.org/packages/65/59/07deeddd4d104e98a4d840bc89dcfba48d8f6c9c112414fed2d8e014a15d/archery-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "6f7f91992ed57d0457f791fee2479ec0", "sha256": "8730d0ed4aa51895b9054a56bdb4d5056977e7712064fa24f5a119126699ca53" }, "downloads": -1, "filename": "archery-1.1.2.tar.gz", "has_sig": true, "md5_digest": "6f7f91992ed57d0457f791fee2479ec0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16085, "upload_time": "2018-10-30T14:48:04", "url": "https://files.pythonhosted.org/packages/51/90/8733bdbe06d6445bb7f2759c7e4b595421dc5e2e4a5ccf799e9d987b7e27/archery-1.1.2.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "f83e66e896315fdfe4d0a4c5eda2abd3", "sha256": "bfd4c3acd4ee4808c030939137be2e6df329e670a1fb9834d5692a015c93dfe7" }, "downloads": -1, "filename": "archery-1.2.0.tar.gz", "has_sig": true, "md5_digest": "f83e66e896315fdfe4d0a4c5eda2abd3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16287, "upload_time": "2018-11-01T12:29:15", "url": "https://files.pythonhosted.org/packages/3b/73/3ce78d73b40d18fc65fff1e91d3d604051dfd9c6491e952a8a994be674cd/archery-1.2.0.tar.gz" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "c6c5a801bc2f11278ad6903406689bd9", "sha256": "757fc373793297dd445f1f240ca099484d84ab219b60e11c1eacc853c4e0c568" }, "downloads": -1, "filename": "archery-1.2.2.tar.gz", "has_sig": true, "md5_digest": "c6c5a801bc2f11278ad6903406689bd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16280, "upload_time": "2018-11-01T13:12:54", "url": "https://files.pythonhosted.org/packages/d3/cd/4d15d010d6ed7f9099645ac4f7c194efef3dcb4178a9a1adb6daddd2b726/archery-1.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c6c5a801bc2f11278ad6903406689bd9", "sha256": "757fc373793297dd445f1f240ca099484d84ab219b60e11c1eacc853c4e0c568" }, "downloads": -1, "filename": "archery-1.2.2.tar.gz", "has_sig": true, "md5_digest": "c6c5a801bc2f11278ad6903406689bd9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16280, "upload_time": "2018-11-01T13:12:54", "url": "https://files.pythonhosted.org/packages/d3/cd/4d15d010d6ed7f9099645ac4f7c194efef3dcb4178a9a1adb6daddd2b726/archery-1.2.2.tar.gz" } ] }