Py-Decorate-All
Apply a decorator to all functions in a module.
Installation
pip install decorate-all
Example Usage
from decorate_all import decorate_all_functions
decorate_all_functions(my_decorator, my_module)
decorator (function): the decorator to apply to functions module_name (string): the name of the module to apply the decorator to
If you want to apply the decorator to functions in the current module, pass __name__ the module as make sure to call decorate_all_functions after defining the functions to decorate, i.e. at the end of the script to apply to all functions.
Here is an example for applying a decorator to all functions in a script: (works in a module or interactive console (REPL))
from decorate_all import decorate_all_functions
def test_function():
print("Hello there")
def demo_decorator(func):
def wrapper(*args, **kwargs):
result = func(*args, **kwargs)
return "Decorator was here!"
return wrapper
decorate_all_functions(demo_decorator, __name__)
print(test_function())
The output of the above code is:
Hello there
Decorator was here!
Metadata
Release files for decorate-all 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| decorate_all-0.1.1.tar.gz | 1.6 kB | Without provenance | Details for decorate_all-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| decorate_all-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for decorate_all-0.1.1-py3-none-any.whl |
Total release size: 3.5 kB
Release files / decorate_all-0.1.1.tar.gz
| Download URL | decorate_all-0.1.1.tar.gz |
|---|---|
| Size | 1.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5e60257a429217825fa7d46d68afda10f0627af595cea025cccd10eeca50abad
|
|
BLAKE2b-256 checksum How to use checksums |
f8b13d982f2d84aca2cfe0075be658e5958278131c4e9fdca2c1e6c2351de7f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / decorate_all-0.1.1-py3-none-any.whl
| Download URL | decorate_all-0.1.1-py3-none-any.whl |
|---|---|
| Size | 1.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e1ebdb1d61386f67f592638dbde8d5867bacd42389a82aa47cc5695f7853e39
|
|
BLAKE2b-256 checksum How to use checksums |
f46456ab2f97247305c7285403d2f6e2d33c65e1d32367e4b5f80a789aea2e4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Security for decorate-all 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.