
    YPi                     F    d Z ddlZddlmZ  G d dej                        Zy)aD  This module contains helper functions related to the std-lib asyncio module.

.. versionadded:: 21.11

Warning:
    Contents of this module are intended to be used internally by the library and *not* by the
    user. Changes to this module are not considered breaking changes and may not be documented in
    the changelog.
    N)Literalc                   j     e Zd ZdZdZddeddf fdZedefd       Zde	d   f fd	Z
d fd
Z xZS )TrackedBoundedSemaphorezSimple subclass of :class:`asyncio.BoundedSemaphore` that tracks the current value of the
    semaphore. While there is an attribute ``_value`` in the superclass, it's private and we
    don't want to rely on it.
    _current_valuevaluereturnNc                 2    t         |   |       || _        y N)super__init__r   )selfr   	__class__s     Q/root/twitch_bot/venv/lib/python3.12/site-packages/telegram/ext/_utils/asyncio.pyr   z TrackedBoundedSemaphore.__init__)   s    #    c                     | j                   S r   r   )r   s    r   current_valuez%TrackedBoundedSemaphore.current_value-   s    """r   Tc                 h   K   t         |           d {    | xj                  dz  c_        y7 w)N   T)r   acquirer   r   r   s    r   r   zTrackedBoundedSemaphore.acquire1   s0     goq  	 s   202c                 L    t         |           | xj                  dz  c_        y )Nr   )r   releaser   r   s    r   r   zTrackedBoundedSemaphore.release6   s    q r   )r   )r	   N)__name__
__module____qualname____doc__	__slots__intr   propertyr   r   r   r   __classcell__)r   s   @r   r   r   !   sW    
 $I$c $$ $ #s # #wt} 
! !r   r   )r   asynciotypingr   BoundedSemaphorer    r   r   <module>r&      s$   &  !g66 !r   