a class decorator that applies to all methods
Project description
decorate-all-methods
Decorator that applies a decorator to all methods of a class.
Installing
pip install decorate-all-methods
Example Usage
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 for versioning.
License
This project is licensed under the Apache License, Version 2.0.
Acknowledgments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file decorate-all-methods-0.0.2.tar.gz
.
File metadata
- Download URL: decorate-all-methods-0.0.2.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0be711749bbf4681cd1738fb8867d702437d166953cd0b638079c51ed0a2c770 |
|
MD5 | 04e0fb2abaf3c65dab902c7779f2d7a8 |
|
BLAKE2b-256 | 6c63234989b90902ea20bec12539410b1cab42eea2400ef1554878abb8235526 |