跳转到主要内容

让您的装饰取消

项目描述

让您的装饰取消

安装

$ pip install undecorate

用法

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

  • 修复了在create_class_wrapper和class_wraps中使用时始终引发错误的bug。

  • 移除了CLASS_WRAPPER_DELETES,以及在create_class_wrapper和class_wraps上的相应deleted参数。

0.2 (2014-09-29)

  • 添加了create_class_wrapper和class_wraps。

  • 内部使用__wrapped__来匹配Python 3.2+。

  • 添加了functools的wraps和update_wrapper的回滚版本。它们包装了stdlib版本,并确保设置了__wrapped__。

0.1 (2014-09-04)

  • 初始发布

  • unwrappable和unwrap函数

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分布

undecorate-0.2.1.tar.gz (4.3 kB 查看哈希值)

上传时间 源代码

构建分发版

undecorate-0.2.1-py2.py3-none-any.whl (4.9 kB 查看哈希值)

上传时间 Python 2 Python 3

支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面