aiwonderland.functools
My main Python functools toolset.
Additional functools in the spirit of the standard library's functools.
pip install -e . to install from a checkout. Python 3.10+. No
runtime dependencies.
aiwonderland.functools
| Decorator / factory | What it does |
|---|---|
once(func) |
run func at most once, cache the result |
silent(default) |
catch Exception, return default |
pipe(*funcs) |
left-to-right composition |
pass_param(func, validator, fb) |
short-circuit on a sentinel first argument |
memoize(func) |
cache results keyed by arguments |
tap(side_effect=print) |
log calls; return value unchanged |
print_yielded(func) |
print every value a generator yields |
run_sync(coro_func) |
call an async def synchronously |
See each callable's docstring for parameters, return type, and examples.
from aiwonderland.functools import memoize, pipe, run_sync
@memoize
def fib(n):
return n if n < 2 else fib(n - 1) + fib(n - 2)
@run_sync
async def fetch_status():
return "ok"
print(fib(50), pipe(lambda x: x * 2, lambda x: x + 1)(3), fetch_status())
License
MIT. See LICENSE.
Metadata
Release files for aiwonderland 1.0.0
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 | |
|---|---|---|---|---|
| aiwonderland-1.0.0.tar.gz | 9.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aiwonderland-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.4 kB
Release files / aiwonderland-1.0.0.tar.gz
| Download URL | aiwonderland-1.0.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71447d7902c9fb8d1f34a489d3bb2f7a429939b9b8ccd6b4d8f31ac03f711501
|
|
BLAKE2b-256 checksum How to use checksums |
6ec47e8fd928763be04c49695c525956ea34bba6b9dcfcfee1d3dd2194f55150
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / aiwonderland-1.0.0-py3-none-any.whl
| Download URL | aiwonderland-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd1aa59f29a6796edccd56399498e952a4f86199a8e9e8867123ce6199c73c49
|
|
BLAKE2b-256 checksum How to use checksums |
d4836bb4977ec5f8fe4630a8333bfa485a8e1bb7e82247306ada3bb3e2da4fa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for aiwonderland 1.0.0
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.