{ "info": { "author": "Robin Hilliard", "author_email": "robin@rocketboots.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.6" ], "description": "In the Elixir programming language the ``|>`` pipe operator allows you\nto chain together multiple function calls so that this::\n\n c(b(a(1, 2), 3, 4))\n\ncan be written more readably as::\n\n 1 |> a(2) |> b(3, 4) |> c()\n\nAll the pipe operator does is pass its left operand as the first argument of\nthe right operand, so that ``a |> b(...)`` becomes ``b(a, ...)``.\n\nVarious pipe implementations in Python to date allow a list of functions to be\napplied to an initial value, but do not support the partial, missing first\nargument syntax of Elixir.\n\nThis library provides a function decorator that causes Python ``>>`` right\nshift operators within the function to act exactly like Elixir pipes::\n\n from pipeop import pipes\n\n def add(a, b):\n return a + b\n\n def times(a, b):\n return a * b\n\n @pipes\n def calc()\n print 1 >> add(2) >> times(3) # prints 9\n\nFunctions can have any number of arguments::\n\n def add3(a, b, c):\n return a + b + c\n\n @pipes\n def calc()\n print 1 >> add3(2, 3) # prints 6\n\nIn Elixir libraries the first argument of a function is chosen with pipes in\nmind but this is (obviously) not the case in Python - for instance the\nenumerable args of ``map`` and ``reduce`` are first in their Elixir equivalents\nbut last in Python. For this reason I've also redefined the left shift operator\n``<<`` to *append* it's left operand to the list of call arguments of the right\noperand::\n\n @pipes\n def my_pow():\n print 2 >> pow(3) # prints 8\n print 2 << pow(3) # prints 9\n\nYou can drop the braces for functions or lambdas (enclosed in braces) with a single argument::\n\n @pipes\n def sum(self):\n print [1, 2, 3] >> sum # prints 6\n print 1 >> (lambda x: x + 1) # prints 2\n\nIn Elixir pipes are often laid out one per line. In Python you need brackets to do the\nsame thing without line continuations, but it still looks pretty neat::\n\n @pipes\n def pretty_pipe():\n print (\n range(-5, 0)\n << map(lambda x: x + 1)\n << map(abs)\n << map(str)\n >> tuple\n ) # prints ('4', '3', '2', '1', '0')\n\nThe decorator can also be applied to a class to decorate all the methods in that class.\n\nNormally there should be a small amount of processing overhead on the first time the\nfunction is defined due to the function being recompiled. Otherwise there should be\nno difference to the performance of the conventionally nested call code.\n\nThis is initial alpha code. It has been tested on Python 2.7.14 and 3.6.5 using\nsimple functions. Source line attributes are preserved so debuggers should be\nable to follow the code as it executes. Pull requests and bug reports gratefully\naccepted.\n\nRobin Hilliard\n\n*PS: Thanks to https://github.com/Stvad for submitting the first issue with some\ngreat suggestions.*", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/robinhilliard/pipes/blob/master/dist/pipeop-0.3.0.tar.gz?raw=true", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/robinhilliard/pipes", "keywords": "python elixir pipe", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pipeop", "package_url": "https://pypi.org/project/pipeop/", "platform": "", "project_url": "https://pypi.org/project/pipeop/", "project_urls": { "Download": "https://github.com/robinhilliard/pipes/blob/master/dist/pipeop-0.3.0.tar.gz?raw=true", "Homepage": "https://github.com/robinhilliard/pipes" }, "release_url": "https://pypi.org/project/pipeop/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "A decorator that changes the >> and << operators to mimic Elixir-style function pipes", "version": "0.3.0" }, "last_serial": 4043384, "releases": { "0.1.6": [ { "comment_text": "", "digests": { "md5": "6e9cea82308ab2c085a47df30e01e9e5", "sha256": "1fe8a6845ee070cf5be6cd2f7e0fa4a8298e6ab3ad6920a1dacf1b51afda68c0" }, "downloads": -1, "filename": "pipeop-0.1.6.tar.gz", "has_sig": false, "md5_digest": "6e9cea82308ab2c085a47df30e01e9e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1694, "upload_time": "2018-04-10T00:43:36", "url": "https://files.pythonhosted.org/packages/6d/09/5b6108e5b063371ee7b3eea6b4f55e57a44617174a190c71057e37652f40/pipeop-0.1.6.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "494c61dbd1d0db7ea96d2b7747ee1f18", "sha256": "cddfcfbc3a7c7ed50dfc88a42a481c3fc82e22f515a5c1c017f5538243396b1c" }, "downloads": -1, "filename": "pipeop-0.1.8.tar.gz", "has_sig": false, "md5_digest": "494c61dbd1d0db7ea96d2b7747ee1f18", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2756, "upload_time": "2018-06-23T12:40:30", "url": "https://files.pythonhosted.org/packages/91/75/d8c54526b1db315b5f20a2a859b9961ea48c5c49cd4d97684ede4358d72b/pipeop-0.1.8.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "8156fe64b772fdab8f81a8bf2965eda6", "sha256": "41db1f5537a31115871fd69b3c22e2b18ef980f3ab9b958787345a432c9ddd0f" }, "downloads": -1, "filename": "pipeop-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8156fe64b772fdab8f81a8bf2965eda6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3423, "upload_time": "2018-06-28T07:01:39", "url": "https://files.pythonhosted.org/packages/83/b6/15c9c3e0ca63e29d862579034c82b9c65e19148fbd95095ebf5ef9c188b4/pipeop-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "4895c3a9cc29780b4d76f19cbccc42bd", "sha256": "0083bf504d415dd57e3167aa7d08f385def8f61086e9bf5ff80fa973674b02b4" }, "downloads": -1, "filename": "pipeop-0.2.1.tar.gz", "has_sig": false, "md5_digest": "4895c3a9cc29780b4d76f19cbccc42bd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3412, "upload_time": "2018-07-07T07:23:59", "url": "https://files.pythonhosted.org/packages/03/75/263eb0bcfe34cbdfdf5e6212e7d9bf8b27b7adcfadb6c0ebbe2d338c2263/pipeop-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "d8e775186bad6910c0062174941d9f29", "sha256": "49fc5041b19d9ab921c87f0de5f9ba0873ebec9a0ee212ad170291b1f090692e" }, "downloads": -1, "filename": "pipeop-0.2.2.tar.gz", "has_sig": false, "md5_digest": "d8e775186bad6910c0062174941d9f29", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3418, "upload_time": "2018-07-07T07:38:09", "url": "https://files.pythonhosted.org/packages/f3/71/5449fe7a4ca9ecef67bca9ceb13a163d7326fc0c325b6642694e7da5c0fc/pipeop-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "86fcc8489c1ea72586182742eea33f30", "sha256": "eb02f6d64972f97f940a8c62972f73aeaff329651b49c0e4bf7bf03b02c39a08" }, "downloads": -1, "filename": "pipeop-0.2.3.tar.gz", "has_sig": false, "md5_digest": "86fcc8489c1ea72586182742eea33f30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3615, "upload_time": "2018-07-09T01:09:51", "url": "https://files.pythonhosted.org/packages/28/df/7cc00a5e29c5c526de09cdaf18f63fa65610a9d45ed905dd52f101aaaa4a/pipeop-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "9a5509a2ae5abf7a8bd2d6eb1ec799fe", "sha256": "e5cd27b1ccc55dd4cf944b4fe2641fe3652e785cf2e631eafc0ebda9aafa243d" }, "downloads": -1, "filename": "pipeop-0.2.4.tar.gz", "has_sig": false, "md5_digest": "9a5509a2ae5abf7a8bd2d6eb1ec799fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3813, "upload_time": "2018-07-09T01:52:48", "url": "https://files.pythonhosted.org/packages/bd/f0/79123a59483f5fa2b7a2cee963d3c510642a2b4ec37384ab632890693a66/pipeop-0.2.4.tar.gz" } ], "0.2.5": [ { "comment_text": "", "digests": { "md5": "6dc712d6e42645caa6dea7c30e6e0636", "sha256": "2945218f6e3b19aff8f73723d9468f1b32ff7b89625509517376b8deceff32e6" }, "downloads": -1, "filename": "pipeop-0.2.5.tar.gz", "has_sig": false, "md5_digest": "6dc712d6e42645caa6dea7c30e6e0636", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3815, "upload_time": "2018-07-09T05:13:07", "url": "https://files.pythonhosted.org/packages/2c/9c/09c24f7f1269f77ef0575483edcd52db24fbf6ae4d2762e2cb63d5c2bb37/pipeop-0.2.5.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "399ccd33859ead2f9451f865ad143c8d", "sha256": "d41664f141eb17dbe0c52fdb49252cd2d640b953dbb706caa8412617a513301e" }, "downloads": -1, "filename": "pipeop-0.3.0.tar.gz", "has_sig": false, "md5_digest": "399ccd33859ead2f9451f865ad143c8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3508, "upload_time": "2018-07-09T12:02:02", "url": "https://files.pythonhosted.org/packages/ce/e6/ab4b8fbcf3a62899740e55d98eb60e0388c1647787c84c5ebc3ffbd21208/pipeop-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "399ccd33859ead2f9451f865ad143c8d", "sha256": "d41664f141eb17dbe0c52fdb49252cd2d640b953dbb706caa8412617a513301e" }, "downloads": -1, "filename": "pipeop-0.3.0.tar.gz", "has_sig": false, "md5_digest": "399ccd33859ead2f9451f865ad143c8d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3508, "upload_time": "2018-07-09T12:02:02", "url": "https://files.pythonhosted.org/packages/ce/e6/ab4b8fbcf3a62899740e55d98eb60e0388c1647787c84c5ebc3ffbd21208/pipeop-0.3.0.tar.gz" } ] }