def __init__(self, max_rate, time_utils=None, rate_tracker=None,
                 consumption_scheduler=None):
        """A leaky bucket abstraction to limit bandwidth consumption

        :type rate: int
        :type rate: The maximum rate to allow. This rate is in terms of
            bytes per second.

        :type time_utils: TimeUtils
        :param time_utils: The time utility to use for interacting with time

        :type rate_tracker: BandwidthRateTracker
        :param rate_tracker: Tracks bandwidth consumption

        :type consumption_scheduler: ConsumptionScheduler
        :param consumption_scheduler: Schedules consumption retries when
            necessary
        """
        self._max_rate = float(max_rate)
        self._time_utils = time_utils
        if time_utils is None:
            self._time_utils = TimeUtils()
        self._lock = threading.Lock()
        self._rate_tracker = rate_tracker
        if rate_tracker is None:
            self._rate_tracker = BandwidthRateTracker()
        self._consumption_scheduler = consumption_scheduler
        if consumption_scheduler is None:
            self._consumption_scheduler = ConsumptionScheduler()
def __init__ ( self , max_rate , time_utils = None , rate_tracker = None , consumption_scheduler = None ) : self . _max_rate = float ( max_rate ) self . _time_utils = time_utils if time_utils is None : self . _time_utils = TimeUtils ( ) self . _lock = threading . Lock ( ) self . _rate_tracker = rate_tracker if rate_tracker is None : self . _rate_tracker = BandwidthRateTracker ( ) self . _consumption_scheduler = consumption_scheduler if consumption_scheduler is None : self . _consumption_scheduler = ConsumptionScheduler ( )
A leaky bucket abstraction to limit bandwidth consumption

        :type rate: int
        :type rate: The maximum rate to allow. This rate is in terms of
            bytes per second.

        :type time_utils: TimeUtils
        :param time_utils: The time utility to use for interacting with time

        :type rate_tracker: BandwidthRateTracker
        :param rate_tracker: Tracks bandwidth consumption

        :type consumption_scheduler: ConsumptionScheduler
        :param consumption_scheduler: Schedules consumption retries when
            necessary