
    i                     D    d Z ddlZddlmZ  G d dej                  ZdS )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                   v     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                 X    t                                          |           || _        d S N)super__init__r   )selfr	   	__class__s     [/Users/shanyulin/my-agent/.venv/lib/python3.11/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                 x   K   t                                                       d {V  | xj        dz  c_        dS )Nr   T)r   acquirer   r   r   s    r   r   zTrackedBoundedSemaphore.acquire1   sF      ggooq tr   c                 h    t                                                       | xj        dz  c_        d S )Nr   )r   releaser   r   s    r   r   zTrackedBoundedSemaphore.release6   s1    q r   )r   )r
   N)__name__
__module____qualname____doc__	__slots__intr   propertyr   r   r   r   __classcell__)r   s   @r   r   r   !   s         
 $I$ $c $$ $ $ $ $ $ $ #s # # # X#wt}      
! ! ! ! ! ! ! ! ! !r   r   )r   asynciotypingr   BoundedSemaphorer    r   r   <module>r&      sc   &        ! ! ! ! !g6 ! ! ! ! !r   