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

  • 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


Download files

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

Source Distribution

undecorate-0.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

undecorate-0.2-py2.py3-none-any.whl (4.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file undecorate-0.2.tar.gz.

File metadata

  • Download URL: undecorate-0.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for undecorate-0.2.tar.gz
Algorithm Hash digest
SHA256 d9479a228786cf7bef1d5cb06f8a4123c3a374e45a9a461816b5454d434e2e99
MD5 5e26d5bad26d55984aad2eb0f617b7f6
BLAKE2b-256 15502488e0bc63ca559a821e3187ed6b0ece63d290a9e94076f42877935249a7

See more details on using hashes here.

File details

Details for the file undecorate-0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for undecorate-0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6f34d5a506ad02fe653246a6e6cbf4f2b7562f31134c47769e4e9e099dd529e9
MD5 7dd8d1a764d211057f7feb4eea768117
BLAKE2b-256 17cb30277fdac9337bdb70b9c5fbd4d45684fbf94a6a3ecdc899a84503b68110

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page