No project description provided
Project description
malib
A few utilities that I find useful.
RateLimiter
from malib import RateLimiter
# call a function at most 10 times per minute
rl = RateLimiter(max_calls=10, period=60)
# call .wait() every time before calling the function
rl.wait()
Exact cover
Code inspired by this blog post.
from malib import exact_cover
piece_to_constraints = {"A": {1}, "B": {2, 4}, "C": {2, 3, 5}, "D": {3, 5}}
next(exact_cover(piece_to_constraints))
# ("A", "B", "D")
Testing
pytest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
malib-0.2.0.tar.gz
(2.4 kB
view hashes)
Built Distribution
malib-0.2.0-py3-none-any.whl
(2.8 kB
view hashes)