Let your decorations be undone
Project description
Let your decorations be undone
Installation
$ pip install undecorate
Usage
>>> from undecorate import unwrap, unwrappable
>>>
>>> @unwrappable
... def pack(func):
... def wrapper(args, kwargs):
... return func(*args, **kwargs)
... return wrapper
...
>>> @pack
... def myfunc(a, b=None, c=None):
... return (a, b, c)
...
>>> myfunc('a', b='b')
Traceback (most recent call last):
...
TypeError: wrapper() got an unexpected keyword argument 'b'
>>>
>>> unwrap(myfunc)('a', b='b')
('a', 'b', None)
0.2.1 (2014-09-29)
Fix bug in create_class_wrapper and class_wraps that caused them to always throw an error when used.
Remove CLASS_WRAPPER_DELETES, and corresponding deleted arguments on create_class_wrapper and class_wraps.
0.2 (2014-09-29)
Add create_class_wrapper and class_wraps.
Internally use __wrapped__ to match Python 3.2+.
Add backport versions of functools wraps and update_wrapper. They wrap the stdlib versions, and ensure that __wrapped__ is set.
0.1 (2014-09-04)
Initial Release
unwrappable and unwrap functions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file undecorate-0.2.1.tar.gz
.
File metadata
- Download URL: undecorate-0.2.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d56c72b375dccc69389065e8f3a29f38e625769308f40d4ceb56b20cdde7fc1b |
|
MD5 | 4ea66aace34b6038aa61dc9d27580478 |
|
BLAKE2b-256 | 9c5c9a61620695c69de007d054390b4c972da4a42b21c24917a4a1678f5cd409 |
File details
Details for the file undecorate-0.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: undecorate-0.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b221138176aeeafb7e121589b0829f8ba121e9e5320db569ce0173db771328ba |
|
MD5 | 39cfe1a7d40be9b78d548420d40cc80a |
|
BLAKE2b-256 | 7b91d48dfb3830de993c3012cf627d06314ee9a82e2e95c0eff5415f76b2a22c |