wrappy
Decorators for common developer utilities in Python 3.6+.
Documentation
Documentation is built with Mkdocs and hosted here.
Quick Examples (see the docs for more detail)
from wrappy import probe, guard, todo, memoize
@probe()
def do_some_heavy_computation(a, b, c):
return a * b + c
@probe(show_args=True, show_kwargs=True, show_returns=True)
def someone_elses_code():
# code that does not explain itself
#
# show examples of args, kwargs, and return values at runtime to get some clue
@probe(show_caller=5)
def a_call_chain_would_be_nice():
# find out with show_caller=<number_of_callers_along_the_chain>
@guard(fallback_retval=0)
def this_could_blow_up(a, b):
return a / b
@todo('Not implemented')
def i_am_not_ready():
# code is under construction, so throw an error when called prematurely
@guard()
@memoize()
def recursive_or_dynamic_programming_subroutine(n):
assert isinstance(n, int) and n >= 0
if n == 0:
return 0
return n + recursive_or_dynamic_programming_subroutine(n-1)
Examples by Comparison
This section is under construction!
Release Notes
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wrappy-0.2.7.tar.gz
(5.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wrappy-0.2.7.tar.gz.
File metadata
- Download URL: wrappy-0.2.7.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afba2a4c6fc59b19425dd83ec6285984f2fbe5db105a2634a2cf12216844d5a6
|
|
| MD5 |
14ce49101dd3d5b4db697b8db241f05f
|
|
| BLAKE2b-256 |
92f2378dbc506e0a74dd27d13ae8833e1e6fc89bc65ddd4982e0400a0927466b
|
File details
Details for the file wrappy-0.2.7-py3-none-any.whl.
File metadata
- Download URL: wrappy-0.2.7-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.2 CPython/3.9.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ba7545c91a9f49df899b588fa45815357f1d8fc8a140d85235514c1320ab401
|
|
| MD5 |
643f16827fe71013adfd3a9b6c1b2696
|
|
| BLAKE2b-256 |
5627665a9337328efc85c3a832962e8666ae0ff7aaca41b621737fe6d8ae8ead
|