
                         $    S r SSKr " S S5      rg)zRetry quota implementation.


    Nc                   B    \ rS rSrSr\S4S jrS rS r\S 5       r	Sr
g)	
RetryQuota   i  Nc                 X    Xl         Xl        Uc  [        R                  " 5       nX l        g N)_max_capacity_available_capacity	threadingLock_lock)selfinitial_capacitylocks      )lib/third_party/botocore/retries/quota.py__init__RetryQuota.__init__   s$    -#3 <>>#D
    c                     U R                      XR                  :  a
   SSS5        gU =R                  U-  sl         SSS5        g! , (       d  f       g= f)zAttempt to aquire a certain amount of capacity.

If there's not sufficient amount of capacity available, ``False``
is returned.  Otherwise, ``True`` is returned, which indicates that
capacity was successfully allocated.

NFT)r   r	   )r   capacity_amounts     r   acquireRetryQuota.acquire   sA     ZZ!9!99 Z $$7$	 ZZs   AA
Ac                     U R                   U R                  :X  a  gU R                     [        U R                   U R                  -
  U5      nU =R                  U-  sl        SSS5        g! , (       d  f       g= f)zRelease capacity back to the retry quota.

The capacity being released will be truncated if necessary
to ensure the max capacity is never exceeded.

N)r   r	   r   min)r   r   amounts      r   releaseRetryQuota.release"   s_     !9!99ZZ""T%=%==F $$.$	 ZZs   9A**
A8c                     U R                   $ r   )r	   )r   s    r   available_capacityRetryQuota.available_capacity6   s    '''r   )r	   r   r   )__name__
__module____qualname____firstlineno__INITIAL_CAPACITYr   r   r   propertyr   __static_attributes__ r   r   r   r      s0    (8t  /( ( (r   r   )__doc__r
   r   r'   r   r   <module>r)      s    0( 0(r   