{ "info": { "author": "Katherine Crowson", "author_email": "crowsonkb@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Utilities" ], "description": "partial-apply\n=============\n\nPartial application of functions and method names, supporting placeholder values for positional arguments.\n\nUnlike `functools.partial() `_, placeholder values are supported so that positional arguments for partial application do not need to be supplied solely from left to right. Keyword arguments are handled equivalently to ``functools.partial()``. It is also possible to \"partially apply\" a method name, producing a function which looks up the method to call on the object supplied as its first argument.\n\n**Dependencies:**\n\n- Python 2.7 or 3.4+.\n\n**Installation:**\n\n- ``$ pip install partial-apply``\n\n**Documentation:**\n\n- Sphinx generated API documentation is available in the ``docs`` subdirectory of this repository and is also published on `GitHub Pages `_.\n\nExamples\n--------\n\nAn example of placeholder use:\n``````````````````````````````\n\n.. code:: python\n\n from partial_apply import Empty, PartialFn, PartialMethod\n\n isint = PartialFn(isinstance, Empty, int)\n\nThis makes a function ``isint()`` that takes one positional argument and returns ``True`` if it is an ``int`` and ``False`` otherwise. That is, calling ``isint(1)`` is equivalent to calling ``isinstance(1, int)``. The supplied positional arguments fill in ``Empty`` placeholder slots from left to right before reverting to ``functools.partial()``-style appending.\n\nAn example of ``PartialMethod`` use:\n````````````````````````````````````\n\n.. code:: python\n\n count_true = PartialMethod('count', True)\n count_true((False, True)) # returns 1\n count_true([False, True]) # returns 1\n\nThis makes a function ``count_true()`` that counts the number of ``True`` values in a sequence. It looks up the sequence method ``count`` on the first argument and calls it with the single argument ``True``. The calls shown are equivalent to ``(False, True).count(True)`` and ``[False, True].count(True)``. Since ``count_true()`` only stores the method name and not the method itself, it works on any type with a ``count()`` method.\n\nLike ``PartialFn``, ``PartialMethod`` supports placeholder positional arguments and ``functools.partial()``-like keyword arguments.\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/crowsonkb/partial-apply", "keywords": "functional,higher-order,partial", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "partial-apply", "package_url": "https://pypi.org/project/partial-apply/", "platform": "", "project_url": "https://pypi.org/project/partial-apply/", "project_urls": { "Homepage": "https://github.com/crowsonkb/partial-apply" }, "release_url": "https://pypi.org/project/partial-apply/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Partial application of functions and method names, supporting placeholder values for positional arguments.", "version": "1.0.0" }, "last_serial": 4614568, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "714ff7c883ebf6ab4ae5c96b2ebe720b", "sha256": "477f8b6d8a4019e0b293be72df97225901fe55d8fffc6997ac465f856f0c9444" }, "downloads": -1, "filename": "partial_apply-1.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "714ff7c883ebf6ab4ae5c96b2ebe720b", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5248, "upload_time": "2018-12-19T00:47:07", "url": "https://files.pythonhosted.org/packages/78/df/d8bed299f6a8d0198e22f10cec0f18a9dfa20ba845b0a160c4933013ad4f/partial_apply-1.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9c9bf5aace927e027aa2436583f87a7", "sha256": "34fde581a8380f025b6386cc15cbb8c3c47c718e88b6312765da6a2ca6c0430d" }, "downloads": -1, "filename": "partial_apply-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b9c9bf5aace927e027aa2436583f87a7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5251, "upload_time": "2018-12-19T00:47:09", "url": "https://files.pythonhosted.org/packages/1f/b6/ac0316759271f12cf88dce3a667af6a78643646e6d462d753cf0ba311d8f/partial_apply-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1f2f0afb1cb11d8170fa021e273cf7f3", "sha256": "1241f8c2789f8e01c6171471f19f8bf77fb553ae363d63dabb13c9a4ba286bec" }, "downloads": -1, "filename": "partial-apply-1.0.0.tar.gz", "has_sig": false, "md5_digest": "1f2f0afb1cb11d8170fa021e273cf7f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4525, "upload_time": "2018-12-19T00:47:10", "url": "https://files.pythonhosted.org/packages/db/8d/0b978badb6e725ce8c0a2c8f6b87fbe4f04668a9b14f5310fc3e44469f11/partial-apply-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "714ff7c883ebf6ab4ae5c96b2ebe720b", "sha256": "477f8b6d8a4019e0b293be72df97225901fe55d8fffc6997ac465f856f0c9444" }, "downloads": -1, "filename": "partial_apply-1.0.0-py2-none-any.whl", "has_sig": false, "md5_digest": "714ff7c883ebf6ab4ae5c96b2ebe720b", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 5248, "upload_time": "2018-12-19T00:47:07", "url": "https://files.pythonhosted.org/packages/78/df/d8bed299f6a8d0198e22f10cec0f18a9dfa20ba845b0a160c4933013ad4f/partial_apply-1.0.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b9c9bf5aace927e027aa2436583f87a7", "sha256": "34fde581a8380f025b6386cc15cbb8c3c47c718e88b6312765da6a2ca6c0430d" }, "downloads": -1, "filename": "partial_apply-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b9c9bf5aace927e027aa2436583f87a7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5251, "upload_time": "2018-12-19T00:47:09", "url": "https://files.pythonhosted.org/packages/1f/b6/ac0316759271f12cf88dce3a667af6a78643646e6d462d753cf0ba311d8f/partial_apply-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1f2f0afb1cb11d8170fa021e273cf7f3", "sha256": "1241f8c2789f8e01c6171471f19f8bf77fb553ae363d63dabb13c9a4ba286bec" }, "downloads": -1, "filename": "partial-apply-1.0.0.tar.gz", "has_sig": false, "md5_digest": "1f2f0afb1cb11d8170fa021e273cf7f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4525, "upload_time": "2018-12-19T00:47:10", "url": "https://files.pythonhosted.org/packages/db/8d/0b978badb6e725ce8c0a2c8f6b87fbe4f04668a9b14f5310fc3e44469f11/partial-apply-1.0.0.tar.gz" } ] }