--- solution.py +++ solution.py (mutant) @@ -3,3 +3,2 @@ import time - @@ -9,20 +8,5 @@ def __init__(self, rate, capacity): - if rate <= 0 or capacity <= 0: - raise ValueError("rate and capacity must be positive") - self._rate = float(rate) - self._capacity = float(capacity) - self._tokens = float(capacity) - self._last = time.monotonic() - self._lock = threading.Lock() + pass def consume(self, tokens=1.0): - """Try to consume tokens; return True on success.""" - with self._lock: - now = time.monotonic() - self._tokens = min(self._capacity, - self._tokens + (now - self._last) * self._rate) - self._last = now - if tokens <= self._tokens: - self._tokens -= tokens - return True - return False + pass