tessl install tessl/pypi-pyrate-limiter@3.9.0Python Rate-Limiter using Leaky-Bucket Algorithm for controlling request rates in applications with multiple backend storage options.
Agent Success
Agent success rate when using this tile
81%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.45x
Baseline
Agent success rate without this tile
56%
{
"context": "This evaluation assesses the engineer's ability to implement a custom storage backend for PyrateLimiter by correctly using the package's abstract bucket interface, rate handling mechanisms, and architectural patterns. The criteria focus exclusively on how well the implementation leverages PyrateLimiter's APIs and abstractions.",
"type": "weighted_checklist",
"checklist": [
{
"name": "AbstractBucket inheritance",
"description": "The JSONFileBucket class properly inherits from AbstractBucket or implements all required abstract methods (put, leak, flush, count, peek, waiting, close, __enter__, __exit__) with correct signatures matching the abstract interface.",
"max_score": 15
},
{
"name": "Rate object usage",
"description": "The implementation correctly uses Rate objects from the rates list to determine rate limits, accessing Rate.limit for the count threshold and Rate.interval for the time window in milliseconds.",
"max_score": 15
},
{
"name": "RateItem handling",
"description": "The implementation properly works with RateItem objects, accessing the item's name attribute for identification and timestamp attribute for time-based calculations in milliseconds.",
"max_score": 15
},
{
"name": "Multiple rate enforcement",
"description": "The put() method correctly enforces all rates in the rates list, checking that items within each rate's interval don't exceed that rate's limit, returning False if any rate is violated.",
"max_score": 15
},
{
"name": "Leak implementation",
"description": "The leak() method correctly removes items older than the longest rate interval by comparing item timestamps against current_timestamp minus rate.interval, returning the count of removed items.",
"max_score": 10
},
{
"name": "Waiting calculation",
"description": "The waiting() method correctly calculates wait time by finding the oldest item that needs to expire for the new item to fit, using rate intervals and item timestamps to compute milliseconds until space is available.",
"max_score": 10
},
{
"name": "Context manager",
"description": "The class implements __enter__ and __exit__ methods to support Python's with statement, calling close() in __exit__ for proper resource cleanup.",
"max_score": 5
},
{
"name": "Thread synchronization",
"description": "The implementation uses threading.RLock or threading.Lock to protect all file operations and shared state access, ensuring thread-safe read-modify-write sequences.",
"max_score": 10
},
{
"name": "File persistence",
"description": "The implementation correctly persists rate items to JSON format, storing at minimum the timestamp and name fields, loading from file on initialization if it exists, and saving after each modification.",
"max_score": 5
}
]
}