让您的装饰取消
项目描述
让您的装饰取消
安装
$ 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的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | d56c72b375dccc69389065e8f3a29f38e625769308f40d4ceb56b20cdde7fc1b |
|
MD5 | 4ea66aace34b6038aa61dc9d27580478 |
|
BLAKE2b-256 | 9c5c9a61620695c69de007d054390b4c972da4a42b21c24917a4a1678f5cd409 |
关闭
undecorate-0.2.1-py2.py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b221138176aeeafb7e121589b0829f8ba121e9e5320db569ce0173db771328ba |
|
MD5 | 39cfe1a7d40be9b78d548420d40cc80a |
|
BLAKE2b-256 | 7b91d48dfb3830de993c3012cf627d06314ee9a82e2e95c0eff5415f76b2a22c |