attrcheck-0.1.2
توضیحات
A simple attribution checker implemented as a decorator
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | attrcheck-0.1.2 |
| نام | attrcheck |
| نسخه کتابخانه | 0.1.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Jun Namikawa |
| ایمیل نویسنده | jnamika@gmail.com |
| آدرس صفحه اصلی | https://github.com/jnamika/attrcheck |
| آدرس اینترنتی | https://pypi.org/project/attrcheck/ |
| مجوز | ISC License (ISCL) |
attrcheck: attribution checker
This module provides a simple attribution checker implemented as a decorator.
All functionality are provided as keyword arguments of the decorator.
Sample example of usage is following:
>>> from attrcheck import attrcheck
>>> @attrcheck(x=['real'], y=['index', 'strip'], z=dir(list))
... def foo(x, y, z=[]): pass
The code above means the following:
>>> def foo(x, y, z=[]):
... if not hasattr(x, 'real'):
... raise AttributeError
... if not hasattr(y, 'index'):
... raise AttributeError
... if not hasattr(y, 'strip'):
... raise AttributeError
... for name in dir(list):
... if not hasattr(z, name):
... raise AttributeError
In addition, attrcheck can check default argument values.
Thus, the following code throws AttributeError.
>>> @attrcheck(y=dir(str))
... def bar(x, y=[]): pass
نحوه نصب
نصب پکیج whl attrcheck-0.1.2:
pip install attrcheck-0.1.2.whl
نصب پکیج tar.gz attrcheck-0.1.2:
pip install attrcheck-0.1.2.tar.gz