decorate-all-methods-0.0.2
توضیحات
a class decorator that applies to all methods
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | decorate-all-methods-0.0.2 |
| نام | decorate-all-methods |
| نسخه کتابخانه | 0.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Dave Gallant |
| ایمیل نویسنده | davegallant@gmail.com |
| آدرس صفحه اصلی | https://github.com/davegallant/decorate_all_methods |
| آدرس اینترنتی | https://pypi.org/project/decorate-all-methods/ |
| مجوز | Apache License, Version 2.0 |
# decorate-all-methods
Decorator that applies a decorator to all methods of a class.
## Installing
```bash
pip install decorate-all-methods
```
## Example Usage
```python
from decorate_all_methods import decorate_all_methods
from tenacity import retry, stop_after_attempt, wait_fixed
@decorate_all_methods(retry(stop=stop_after_attempt(3), wait=wait_fixed(1)), exclude=['__init__'])
class MyClass(object):
def __init__(self, object):
"""Will not be retried."""
pass
def force_error(self):
"""Will be retried 3 times."""
assert False
def force_another_error(self):
"""Will also be retried 3 times."""
assert False
```
_Note: It is not necessary to exclude any methods._
## Versioning
We use [SemVer](http://semver.org/) for versioning.
## License
This project is licensed under the Apache License, Version 2.0.
## Acknowledgments
* https://stackoverflow.com/a/6307868/1191286
نحوه نصب
نصب پکیج whl decorate-all-methods-0.0.2:
pip install decorate-all-methods-0.0.2.whl
نصب پکیج tar.gz decorate-all-methods-0.0.2:
pip install decorate-all-methods-0.0.2.tar.gz