A python package provides speed limiting iterators other various helpers using the leaky token bucket algorithm.
Project description
Speed limit utilities that use the token bucket algorithm internally.
An example:
>>> import string
>>> import time
>>>
>>> import speedlimit
>>>
>>> police = speedlimit.SpeedLimit(1)
>>>
>>> it = iter(string.ascii_lowercase)
>>> t_zero = time.time()
>>>
>>> for alpha in police.speed_limit_iter(it):
... print("Got %s at %0.2f" % (alpha, time.time() - t_zero))
...
Got a at 1.00
Got b at 2.00
Got c at 3.00
Got d at 4.00
Got e at 5.00
Got f at 6.00
Got g at 7.00
Got h at 8.00
Got i at 9.00
Got j at 10.00
Got k at 11.00
Got l at 12.00
Got m at 13.00
Got n at 14.00
Got o at 15.00
Got p at 16.00
Got q at 17.00
Got r at 18.00
Got s at 19.00
Got t at 20.00
Got u at 21.00
Got v at 22.00
Got w at 23.00
Got x at 24.00
Got y at 25.00
Got z at 26.00
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
speedlimit-0.1.1.tar.gz
(3.4 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 speedlimit-0.1.1.tar.gz.
File metadata
- Download URL: speedlimit-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2a07d4f28b243513393293b6962b3fc33094b0e4f909830a720680d89b8c84a9
|
|
| MD5 |
067d4490ab773d0ca165a94e0bedb659
|
|
| BLAKE2b-256 |
0d256824569df0649c210e7ca1ddd1bbf00b2ed2d9f6a9d12fd67c13d472ddfb
|
File details
Details for the file speedlimit-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: speedlimit-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cba8c8f51be6f4502ffac24c61c609f6cdd43b09fe82b9fcf49ac6b868a92eb
|
|
| MD5 |
6158f0909d17edc134bca6d520d5cdd3
|
|
| BLAKE2b-256 |
b3dbd1f4679d19baf90993cf5710ca570513746a2b0d3bb9bbbd5f20ec0efe78
|