File: //usr/lib/python3.6/site-packages/s3transfer/__pycache__/bandwidth.cpython-36.pyc
3
\��_= � @ s� d dl Z d dlZG dd� de�ZG dd� de�ZG dd� de�ZG dd � d e�ZG d
d� de�ZG dd
� d
e�Z G dd� de�Z
G dd� de�ZdS )� Nc s e Zd Z� fdd�Z� ZS )�RequestExceededExceptionc s, || _ || _d||f }tt| �j|� dS )a� Error when requested amount exceeds what is allowed
The request that raised this error should be retried after waiting
the time specified by ``retry_time``.
:type requested_amt: int
:param requested_amt: The originally requested byte amount
:type retry_time: float
:param retry_time: The length in time to wait to retry for the
requested amount
z<Request amount %s exceeded the amount available. Retry in %sN)�
requested_amt�
retry_time�superr �__init__)�selfr r �msg)� __class__� �/usr/lib/python3.6/bandwidth.pyr s
z!RequestExceededException.__init__)�__name__�
__module__�__qualname__r �
__classcell__r
r
)r r r s r c @ s e Zd ZdZdS )�RequestTokenzDA token to pass as an identifier when consuming from the LeakyBucketN)r r
r �__doc__r
r
r
r r ( s r c @ s e Zd Zdd� Zdd� ZdS )� TimeUtilsc C s t j � S )zgGet the current time back
:rtype: float
:returns: The current time in seconds
)�time)r r
r
r r . s zTimeUtils.timec C s
t j|�S )zwSleep for a designated time
:type value: float
:param value: The time to sleep for in seconds
)r �sleep)r �valuer
r
r r 6 s zTimeUtils.sleepN)r r
r r r r
r
r
r r - s r c @ s e Zd Zddd�Zddd�ZdS ) �BandwidthLimiterNc C s || _ || _|dkrt� | _dS )a Limits bandwidth for shared S3 transfers
:type leaky_bucket: LeakyBucket
:param leaky_bucket: The leaky bucket to use limit bandwidth
:type time_utils: TimeUtils
:param time_utils: Time utility to use for interacting with time.
N)�
_leaky_bucket�_time_utilsr )r �leaky_bucket�
time_utilsr
r
r r @ s zBandwidthLimiter.__init__Tc C s"