{ "info": { "author": "Stefan Otte", "author_email": "stefan.otte@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "################################\npelper - python helper functions\n################################\n\n|docs| |coverage_status| |build_status| |pypi| |github|\n\n``pelper`` -- python helper functions to ease measuring, ignoring, caching,\npiping, functional helpers, and more for python 2.7, 3.4, and 3.5.\n\n``pelper`` contains useful helper functions, decorators, context managers\n- all the things that make your python life a tiny bit easier.\n``pelper`` has no dependencies,\nhas a coverage of 100%,\nand is well documented.\n\n\nExamples\n========\n\nPipe data through unix-like/elixir-like pipes:\n\n.. code:: python\n\n >>> from pelper import pipe\n >>> pipe(\"some datat, some data\", set, (sorted, {\"reverse\": True}))\n ['t', 's', 'o', 'm', 'e', 'd', 'a', ',', ' ']\n\n\nPelper offers `p`-functions, i.e., functions where the first argument is data.\nThere is ``pmap`` (like map, but works with ``pipel``):\n\n.. code:: python\n\n >>> from pelper import pipe, pmap\n >>> pipe(\n ... range(5),\n ... (pmap, lambda x: x*x),\n ... list)\n [0, 1, 4, 9, 16]\n\n\n...and also pfilter:\n\n.. code:: python\n\n >>> from pelper import pipe, pfilter\n >>> pipe(\n ... range(5),\n ... (pfilter, lambda x: x > 2),\n ... list)\n [3, 4]\n\n\nTake `n` elements from iterables (useful if you can't use the square bracket\nnotation, e.g., if you're using pipe)\n\n.. code:: python\n\n >>> from pelper import take\n >>> take(\"hello world\", 5)\n ['h', 'e', 'l', 'l', 'o']\n\n\nTake the `n`-th elements from iterables (useful if you can't use the square\nbracket notation, e.g., if you're using pipe)\n\n.. code:: python\n\n >>> from pelper import nth\n >>> nth(range(5), 2)\n 2\n\n\nFlatten arbitrarily nested lists:\n\n.. code:: python\n\n >>> from pelper import flatten\n >>> flatten([1, [2, 2, [3, 3]]])\n [1, 2, 2, 3, 3]\n\n\nMeasure the duration of a function:\n\n.. code:: python\n\n >>> from pelper import print_duration\n >>> @print_duration()\n ... def f(n): pass\n\n\nMeasure the duration of a context:\n\n.. code:: python\n\n >>> from pelper import print_duration\n >>> with print_duration():\n ... range(4)\n\n\nIgnore exceptions:\n\n.. code:: python\n\n >>> from pelper import ignored\n >>> with ignored(OSError):\n ... raise OSError() # this is ignored\n\n\nCache already computed results of functions:\n\n.. code:: python\n\n >>> from pelper import cache\n >>> @cache\n >>> def fib(n):\n ... return 1 if n < 2 else fib(n-1) + fib(n-2)\n >>> f(500) # this would run for quite a wile without the cache decorator\n\n\nEasier printing and formating:\n\n.. code:: python\n\n >>> from pelper import printf\n >>> printf(\"Hello {name}, I'm {something}\", name=\"Alan\", something=\"world\")\n Hello Alan, I'm world\n\n\nInstallation\n============\n\n``pelper`` is only one file and has no dependencies.\nYou can simply drop ``pelper.py`` into your project and use it.\n\nOr install it from pypi by running::\n\n pip install pelper\n\nOr install it from source by running::\n\n pip install .\n\n\nDevelopment\n===========\n\nUse virtualenv_ for working on ``pelper``.\nInstall the dev requrirements via::\n\n pip install -e requirements-dev.txt\n\nTests\n-----\n\n``pelper`` uses doctest, ``py.test``, and ``tox`` for testing.\nIt also has |coverage_status| coverage.\n\nYou can run the tests for all supported versions of python and build and test\nthe docs::\n\n tox\n\nRun only the tests for the specified version of python::\n\n tox -e py27,py34,py35\n\nAlternatively just run tests for the current version of python::\n\n py.test\n\n\nDocs\n----\n\nBuild the docs via::\n\n cd docs\n sphinx html\n\n\n.. ============================================================================\n.. Links\n\n.. |build_status| image:: https://api.shippable.com/projects/572309a32a8192902e1e65c7/badge?branch=master\n :alt: Build status\n :target: https://app.shippable.com/projects/572309a32a8192902e1e65c7\n\n.. |coverage_status| image:: https://api.shippable.com/projects/572309a32a8192902e1e65c7/coverageBadge?branch=master\n :alt: Coverage status\n :target: https://app.shippable.com/projects/572309a32a8192902e1e65c7\n\n.. |docs| image:: https://readthedocs.org/projects/pelper/badge/?version=latest\n :alt: read the docs\n :target: http://pelper.readthedocs.org/en/latest/\n\n.. |pypi| image:: https://badge.fury.io/py/pelper.svg\n :alt: PyPI page\n :target: https://badge.fury.io/py/pelper\n\n.. |github| image:: https://badge.fury.io/gh/sotte%2Fpelper.svg\n :alt: Github page\n :target: https://badge.fury.io/gh/sotte%2Fpelper\n\n.. _virtualenv: http://docs.python-guide.org/en/latest/dev/virtualenvs/", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/sotte/pelper", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sotte/pelper", "keywords": "development heper functional decorator contextmanager", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pelper", "package_url": "https://pypi.org/project/pelper/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pelper/", "project_urls": { "Download": "https://github.com/sotte/pelper", "Homepage": "https://github.com/sotte/pelper" }, "release_url": "https://pypi.org/project/pelper/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "pelper - python helper functions", "version": "0.1.0" }, "last_serial": 2577181, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "75ef0309b141c34b96d05a918edba398", "sha256": "05919cd3840f7d9e6c6fcaf62427420022a3a85cd50cf06e9789385c36ad2085" }, "downloads": -1, "filename": "pelper-0.0.2.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "75ef0309b141c34b96d05a918edba398", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5604, "upload_time": "2015-06-23T19:03:33", "url": "https://files.pythonhosted.org/packages/60/fd/327f2fc9899ea4ee602a609ff60b9e8c43ab2a8b03790817d26e53352193/pelper-0.0.2.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "67c1a87a8bd305ae70b2547320d95c58", "sha256": "ee168129ecada5bf74c4ab23371d43f878d483845f5844613d51d463d644b1a0" }, "downloads": -1, "filename": "pelper-0.0.2-py2.7.egg", "has_sig": false, "md5_digest": "67c1a87a8bd305ae70b2547320d95c58", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 7889, "upload_time": "2015-06-23T19:03:37", "url": "https://files.pythonhosted.org/packages/01/ea/b8be55931cc6112968edf287d9f0e5269f6713b2bc8d10a21d2b13cfb90d/pelper-0.0.2-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "5086f59ef6cfb4a1385e4f86b358b448", "sha256": "eff70a90f0dc366de393d8a54847cebcb8ce76b4969cea6f4fa3a077d6d2483f" }, "downloads": -1, "filename": "pelper-0.0.2.tar.gz", "has_sig": false, "md5_digest": "5086f59ef6cfb4a1385e4f86b358b448", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4417, "upload_time": "2015-06-23T19:03:40", "url": "https://files.pythonhosted.org/packages/52/30/37ef7ed9fc2c186faf82ccdeba31dc1400f713c390b59f7b8ccd140ba53a/pelper-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "96a7f60d13a5190b0517dd8da084fabd", "sha256": "91df5d0de37ae0dbdacf3cf2c58ce9472a14413677bc2ee2655faa5e77ff4f32" }, "downloads": -1, "filename": "pelper-0.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "96a7f60d13a5190b0517dd8da084fabd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7045, "upload_time": "2015-12-29T14:34:17", "url": "https://files.pythonhosted.org/packages/bb/1f/ce7b1d74d919a335c6608b11d2d5b8bbc83bb4722f3ed001cf836cde25f8/pelper-0.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ab4fb9ba27ddcd6de47b4d606d6b5e15", "sha256": "92e7ca096cc0fccbbbbd97571f3cbdaa5cd53a1c8179f72f2e16d0a51b5441ef" }, "downloads": -1, "filename": "pelper-0.0.3.tar.gz", "has_sig": false, "md5_digest": "ab4fb9ba27ddcd6de47b4d606d6b5e15", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4989, "upload_time": "2015-12-29T14:34:22", "url": "https://files.pythonhosted.org/packages/44/7e/75ffc27540192913948bcabdeb0451c7e456b7f9bb7cdc0457b0220ef401/pelper-0.0.3.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "08011289c3b088e681a570ddb566cf72", "sha256": "d2f91123a3ff841f2cf10f5e39242235cca643711f142e0c2b50567b5ec075e9" }, "downloads": -1, "filename": "pelper-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "08011289c3b088e681a570ddb566cf72", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9156, "upload_time": "2017-01-16T13:11:21", "url": "https://files.pythonhosted.org/packages/25/9b/6f032b61b422e84ac0b567c14ad9e06f4ca945af276354d986e65447d5df/pelper-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b434600731711436fc6d22d67cf9b523", "sha256": "2b753d3c440704161431a7bab5a9e79ab318bab55a77b9732c7352b5ec7eac98" }, "downloads": -1, "filename": "pelper-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b434600731711436fc6d22d67cf9b523", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6465, "upload_time": "2017-01-16T13:11:23", "url": "https://files.pythonhosted.org/packages/5c/df/7a0573d56786b840405bff6a9fd56675e5277b79119d00c27f3d1f7545c6/pelper-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "08011289c3b088e681a570ddb566cf72", "sha256": "d2f91123a3ff841f2cf10f5e39242235cca643711f142e0c2b50567b5ec075e9" }, "downloads": -1, "filename": "pelper-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "08011289c3b088e681a570ddb566cf72", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9156, "upload_time": "2017-01-16T13:11:21", "url": "https://files.pythonhosted.org/packages/25/9b/6f032b61b422e84ac0b567c14ad9e06f4ca945af276354d986e65447d5df/pelper-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b434600731711436fc6d22d67cf9b523", "sha256": "2b753d3c440704161431a7bab5a9e79ab318bab55a77b9732c7352b5ec7eac98" }, "downloads": -1, "filename": "pelper-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b434600731711436fc6d22d67cf9b523", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6465, "upload_time": "2017-01-16T13:11:23", "url": "https://files.pythonhosted.org/packages/5c/df/7a0573d56786b840405bff6a9fd56675e5277b79119d00c27f3d1f7545c6/pelper-0.1.0.tar.gz" } ] }