Skip to main content

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for undecorate, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size undecorate-0.2.1-py2.py3-none-any.whl (4.9 kB) File type Wheel Python version 3.4 Upload date Hashes View
Filename, size undecorate-0.2.1.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page