o
    Zzj�  ã                   @   s.   d Z ddlZddlmZ G d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                       sf   e Zd ZdZdZddeddf‡ fdd„Zedefd	d
„ƒZde	d f‡ fdd„Z
d‡ fdd„Z‡  ZS )ÚTrackedBoundedSemaphorezÙSimple 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                    s   t ƒ  |¡ || _d S ©N)ÚsuperÚ__init__r   )Úselfr   ©Ú	__class__© úV/var/www/kodo/tsheker/venv/lib/python3.10/site-packages/telegram/ext/_utils/asyncio.pyr   )   s   
z TrackedBoundedSemaphore.__init__c                 C   s   | j S r	   r   ©r   r   r   r   Úcurrent_value-   s   z%TrackedBoundedSemaphore.current_valueTc                 ƒ   s$   �t ƒ  ¡ I d H  |  jd8  _dS )Nr   T)r
   Úacquirer   r   r   r   r   r   1   s   €zTrackedBoundedSemaphore.acquirec                    s   t ƒ  ¡  |  jd7  _d S )Nr   )r
   Úreleaser   r   r   r   r   r   6   s   
zTrackedBoundedSemaphore.release)r   )r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__Úintr   Úpropertyr   r   r   r   Ú__classcell__r   r   r   r   r   !   s    r   )r   ÚasyncioÚtypingr   ÚBoundedSemaphorer   r   r   r   r   Ú<module>   s   
