undecorated


Nameundecorated JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/mapleoin/undecorated
SummaryUndecorate python functions, methods or classes
upload_time2017-03-18 12:03:56
maintainerNone
docs_urlNone
authorIonuț Arțăriși
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            undecorated
-----------

This library provides an easy way to strip a function of its decorators.

Tested on python 2.6 up to 3.6: |travis|


.. |travis| image:: https://travis-ci.org/mapleoin/undecorated.svg?branch=master
    :target: https://travis-ci.org/mapleoin/undecorated


Quickstart
``````````

Install:

.. code:: bash

    $ pip install undecorated

Try it on one of your functions:

.. code:: python

   >>> from undecorated import undecorated
   >>> undecorated(my_decorated_function)
   <function my_decorated_function at 0x7fbdd6e95938>

`undecorated` has returned your original function clean of any decorators.


It also works with class decorators!


Example
```````

.. code:: python

    >>> from functools import wraps
    >>> from undecorated import undecorated
    >>>
    >>> def decorate_with(*decorations):
    ...     def decorator(f):
    ...         @wraps(f)
    ...         def wrapper(*args, **kwargs):
    ...             print decorations
    ...             return f(*args, **kwargs)
    ...         return wrapper
    ...     return decorator
    ... 
    >>> @decorate_with('yellow_bauble')
    ... @decorate_with('red_bauble')
    ... @decorate_with('tinsel')
    ... def tree():
    ...     print 'tree'
    ... 
    >>> tree()
    ('yellow_bauble',)
    ('red_bauble',)
    ('tinsel',)
    tree
    >>> undecorated(tree)()
    tree


Project
```````

This project uses `Semantic Versioning <http://semver.org>`.


License
```````

Copyright 2016 Ionuț Arțăriși <ionut@artarisi.eu>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mapleoin/undecorated",
    "name": "undecorated",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Ionu\u021b Ar\u021b\u0103ri\u0219i",
    "author_email": "ionut@artarisi.eu",
    "download_url": "https://files.pythonhosted.org/packages/7d/61/262785a7a47c7613ddd41608d2370e44768d48060d15071f298dbac19f9a/undecorated-0.3.0.tar.gz",
    "platform": "UNKNOWN",
    "description": "undecorated\n-----------\n\nThis library provides an easy way to strip a function of its decorators.\n\nTested on python 2.6 up to 3.6: |travis|\n\n\n.. |travis| image:: https://travis-ci.org/mapleoin/undecorated.svg?branch=master\n    :target: https://travis-ci.org/mapleoin/undecorated\n\n\nQuickstart\n``````````\n\nInstall:\n\n.. code:: bash\n\n    $ pip install undecorated\n\nTry it on one of your functions:\n\n.. code:: python\n\n   >>> from undecorated import undecorated\n   >>> undecorated(my_decorated_function)\n   <function my_decorated_function at 0x7fbdd6e95938>\n\n`undecorated` has returned your original function clean of any decorators.\n\n\nIt also works with class decorators!\n\n\nExample\n```````\n\n.. code:: python\n\n    >>> from functools import wraps\n    >>> from undecorated import undecorated\n    >>>\n    >>> def decorate_with(*decorations):\n    ...     def decorator(f):\n    ...         @wraps(f)\n    ...         def wrapper(*args, **kwargs):\n    ...             print decorations\n    ...             return f(*args, **kwargs)\n    ...         return wrapper\n    ...     return decorator\n    ... \n    >>> @decorate_with('yellow_bauble')\n    ... @decorate_with('red_bauble')\n    ... @decorate_with('tinsel')\n    ... def tree():\n    ...     print 'tree'\n    ... \n    >>> tree()\n    ('yellow_bauble',)\n    ('red_bauble',)\n    ('tinsel',)\n    tree\n    >>> undecorated(tree)()\n    tree\n\n\nProject\n```````\n\nThis project uses `Semantic Versioning <http://semver.org>`.\n\n\nLicense\n```````\n\nCopyright 2016 Ionu\u021b Ar\u021b\u0103ri\u0219i <ionut@artarisi.eu>\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.",
    "bugtrack_url": null,
    "license": null,
    "summary": "Undecorate python functions, methods or classes",
    "version": "0.3.0",
    "project_urls": {
        "Homepage": "https://github.com/mapleoin/undecorated"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "62d5943ec88ba20a41e6d7b6a65224b573fa8ab275dc79d0000fc957096a0968",
                "md5": "82fbded03b757829b1734e395f12a267",
                "sha256": "c627ab442be70240f86bc54f57efae1194a242ee8f051befaf7760f51fb44f22"
            },
            "downloads": -1,
            "filename": "undecorated-0.3.0-py2-none-any.whl",
            "has_sig": false,
            "md5_digest": "82fbded03b757829b1734e395f12a267",
            "packagetype": "bdist_wheel",
            "python_version": "py2",
            "requires_python": null,
            "size": 4824,
            "upload_time": "2017-03-18T12:03:54",
            "upload_time_iso_8601": "2017-03-18T12:03:54.262797Z",
            "url": "https://files.pythonhosted.org/packages/62/d5/943ec88ba20a41e6d7b6a65224b573fa8ab275dc79d0000fc957096a0968/undecorated-0.3.0-py2-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ae6394c4786e13fe1ea5b5743ed9498777befe6a1a5adf30605c6406106463d2",
                "md5": "ddc90aa1ccd74750a1ae670c935d71dd",
                "sha256": "d668d6c076f05b0bdf3bc399af9541f8b9afa4fad653ddec4afa2eca606162f9"
            },
            "downloads": -1,
            "filename": "undecorated-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ddc90aa1ccd74750a1ae670c935d71dd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4824,
            "upload_time": "2017-03-18T12:05:07",
            "upload_time_iso_8601": "2017-03-18T12:05:07.047551Z",
            "url": "https://files.pythonhosted.org/packages/ae/63/94c4786e13fe1ea5b5743ed9498777befe6a1a5adf30605c6406106463d2/undecorated-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7d61262785a7a47c7613ddd41608d2370e44768d48060d15071f298dbac19f9a",
                "md5": "1b8b2e0cbf0c7d5c180d32884a583ae2",
                "sha256": "83eca0a85e6e62ac8bc6bf938c8a70003e58ef084932d5930d7699e5759a3a3e"
            },
            "downloads": -1,
            "filename": "undecorated-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1b8b2e0cbf0c7d5c180d32884a583ae2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 2734,
            "upload_time": "2017-03-18T12:03:56",
            "upload_time_iso_8601": "2017-03-18T12:03:56.585452Z",
            "url": "https://files.pythonhosted.org/packages/7d/61/262785a7a47c7613ddd41608d2370e44768d48060d15071f298dbac19f9a/undecorated-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2017-03-18 12:03:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mapleoin",
    "github_project": "undecorated",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "lcname": "undecorated"
}
        
Elapsed time: 0.22908s