o .&a@s dZddlZGdddeZdS)zRetry quota implementation. Nc@s:eZdZdZedfddZddZddZed d ZdS) RetryQuotaiNcCs&||_||_|durt}||_dSN) _max_capacity_available_capacity threadingLock_lock)selfinitial_capacitylockr 8/usr/lib/python3/dist-packages/botocore/retries/quota.py__init__ s  zRetryQuota.__init__cCsX|j||jkr WddS|j|8_ WddS1s%wYdS)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)rr)r capacity_amountr r r acquires $zRetryQuota.acquirecCs\|j|jkrdS|jt|j|j|}|j|7_WddS1s'wYdS)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)rrrmin)r ramountr r r release"s  "zRetryQuota.releasecCs|jSr)r)r r r r available_capacity7szRetryQuota.available_capacity) __name__ __module__ __qualname__INITIAL_CAPACITYrrrpropertyrr r r r rsr)__doc__robjectrr r r r s