from typing import Any

__all__ = ("TokenBucket",)

class TokenBucket:
    fill_rate: float | None
    capacity: int
    timestamp: float | None

    def __init__(self, fill_rate: float, capacity: int = ...) -> None: ...
    def add(self, item: Any) -> None: ...
    def pop(self) -> Any: ...
    def clear_pending(self) -> None: ...
    def can_consume(self, tokens: int = ...) -> bool: ...
    def expected_time(self, tokens: int = ...) -> float: ...
