Skip to main content

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

Tested on python 2.6 up to 3.6: travis

Quickstart

Install:

$ pip install undecorated

Try it on one of your functions:

>>> 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

>>> 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.

Metadata

Release files for undecorated 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for undecorated 0.3.0
File Size Uploaded
undecorated-0.3.0.tar.gz 2.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for undecorated 0.3.0
File Interpreter ABI Platform
undecorated-0.3.0-py3-none-any.whl Python 3 none any Details
undecorated-0.3.0-py2-none-any.whl Python 2 none any Details

Total release size: 12.4 kB

Release files / undecorated-0.3.0.tar.gz

Download URL undecorated-0.3.0.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
83eca0a85e6e62ac8bc6bf938c8a70003e58ef084932d5930d7699e5759a3a3e
BLAKE2b-256 checksum
How to use checksums
7d61262785a7a47c7613ddd41608d2370e44768d48060d15071f298dbac19f9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / undecorated-0.3.0-py3-none-any.whl

Download URL undecorated-0.3.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d668d6c076f05b0bdf3bc399af9541f8b9afa4fad653ddec4afa2eca606162f9
BLAKE2b-256 checksum
How to use checksums
ae6394c4786e13fe1ea5b5743ed9498777befe6a1a5adf30605c6406106463d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / undecorated-0.3.0-py2-none-any.whl

Download URL undecorated-0.3.0-py2-none-any.whl
Size 4.8 kB
Tags Python 2
SHA-256 checksum
How to use checksums
c627ab442be70240f86bc54f57efae1194a242ee8f051befaf7760f51fb44f22
BLAKE2b-256 checksum
How to use checksums
62d5943ec88ba20a41e6d7b6a65224b573fa8ab275dc79d0000fc957096a0968
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.3.0 This release

3 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page